<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
  <meta name="theme-color" content="#222">
  <meta name="generator" content="Hexo 4.2.1">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/safari-pinned-tab.svg" color="#222">
  <link rel="stylesheet" href="/css/main.css">
  <link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">
  <link rel="stylesheet" href="/lib/pace/pace-theme-minimal.min.css">
  <script src="/lib/pace/pace.min.js"></script>
  <script id="hexo-configurations">
    var NexT = window.NexT ||
    {};
    var CONFIG = {
      "hostname": "cuiqingcai.com",
      "root": "/",
      "scheme": "Pisces",
      "version": "7.8.0",
      "exturl": false,
      "sidebar":
      {
        "position": "right",
        "width": 360,
        "display": "post",
        "padding": 18,
        "offset": 12,
        "onmobile": false,
        "widgets": [
          {
            "type": "image",
            "name": "阿布云",
            "enable": false,
            "url": "https://www.abuyun.com/http-proxy/introduce.html",
            "src": "https://qiniu.cuiqingcai.com/88au8.jpg",
            "width": "100%"
      },
          {
            "type": "image",
            "name": "天验",
            "enable": true,
            "url": "https://tutorial.lengyue.video/?coupon=12ef4b1a-a3db-11ea-bb37-0242ac130002_cqx_850",
            "src": "https://qiniu.cuiqingcai.com/bco2a.png",
            "width": "100%"
      },
          {
            "type": "image",
            "name": "华为云",
            "enable": false,
            "url": "https://activity.huaweicloud.com/2020_618_promotion/index.html?bpName=5f9f98a29e2c40b780c1793086f29fe2&bindType=1&salesID=wangyubei",
            "src": "https://qiniu.cuiqingcai.com/y42ik.jpg",
            "width": "100%"
      },
          {
            "type": "image",
            "name": "张小鸡",
            "enable": false,
            "url": "http://www.zxiaoji.com/",
            "src": "https://qiniu.cuiqingcai.com/fm72f.png",
            "width": "100%"
      },
          {
            "type": "image",
            "name": "Luminati",
            "src": "https://qiniu.cuiqingcai.com/ikkq9.jpg",
            "url": "https://luminati-china.io/?affiliate=ref_5fbbaaa9647883f5c6f77095",
            "width": "100%",
            "enable": false
      },
          {
            "type": "image",
            "name": "IPIDEA",
            "url": "http://www.ipidea.net/?utm-source=cqc&utm-keyword=?cqc",
            "src": "https://qiniu.cuiqingcai.com/0ywun.png",
            "width": "100%",
            "enable": true
      },
          {
            "type": "tags",
            "name": "标签云",
            "enable": true
      },
          {
            "type": "categories",
            "name": "分类",
            "enable": true
      },
          {
            "type": "friends",
            "name": "友情链接",
            "enable": true
      },
          {
            "type": "hot",
            "name": "猜你喜欢",
            "enable": true
      }]
      },
      "copycode":
      {
        "enable": true,
        "show_result": true,
        "style": "mac"
      },
      "back2top":
      {
        "enable": true,
        "sidebar": false,
        "scrollpercent": true
      },
      "bookmark":
      {
        "enable": false,
        "color": "#222",
        "save": "auto"
      },
      "fancybox": false,
      "mediumzoom": false,
      "lazyload": false,
      "pangu": true,
      "comments":
      {
        "style": "tabs",
        "active": "gitalk",
        "storage": true,
        "lazyload": false,
        "nav": null,
        "activeClass": "gitalk"
      },
      "algolia":
      {
        "hits":
        {
          "per_page": 10
        },
        "labels":
        {
          "input_placeholder": "Search for Posts",
          "hits_empty": "We didn't find any results for the search: ${query}",
          "hits_stats": "${hits} results found in ${time} ms"
        }
      },
      "localsearch":
      {
        "enable": true,
        "trigger": "auto",
        "top_n_per_article": 10,
        "unescape": false,
        "preload": false
      },
      "motion":
      {
        "enable": false,
        "async": false,
        "transition":
        {
          "post_block": "bounceDownIn",
          "post_header": "slideDownIn",
          "post_body": "slideDownIn",
          "coll_header": "slideLeftIn",
          "sidebar": "slideUpIn"
        }
      },
      "path": "search.xml"
    };

  </script>
  <meta name="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
  <meta property="og:type" content="website">
  <meta property="og:title" content="静觅">
  <meta property="og:url" content="https://cuiqingcai.com/page/29/index.html">
  <meta property="og:site_name" content="静觅">
  <meta property="og:description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
  <meta property="og:locale" content="zh_CN">
  <meta property="article:author" content="崔庆才">
  <meta property="article:tag" content="崔庆才">
  <meta property="article:tag" content="静觅">
  <meta property="article:tag" content="PHP">
  <meta property="article:tag" content="Java">
  <meta property="article:tag" content="Python">
  <meta property="article:tag" content="Spider">
  <meta property="article:tag" content="爬虫">
  <meta property="article:tag" content="Web">
  <meta property="article:tag" content="Kubernetes">
  <meta property="article:tag" content="深度学习">
  <meta property="article:tag" content="机器学习">
  <meta property="article:tag" content="数据分析">
  <meta property="article:tag" content="网络">
  <meta property="article:tag" content="IT">
  <meta property="article:tag" content="技术">
  <meta property="article:tag" content="博客">
  <meta name="twitter:card" content="summary">
  <link rel="canonical" href="https://cuiqingcai.com/page/29/">
  <script id="page-configurations">
    // https://hexo.io/docs/variables.html
    CONFIG.page = {
      sidebar: "",
      isHome: true,
      isPost: false,
      lang: 'zh-CN'
    };

  </script>
  <title>静觅丨崔庆才的个人站点</title>
  <meta name="google-site-verification" content="p_bIcnvirkFzG2dYKuNDivKD8-STet5W7D-01woA2fc" />
  <noscript>
    <style>
      .use-motion .brand,
      .use-motion .menu-item,
      .sidebar-inner,
      .use-motion .post-block,
      .use-motion .pagination,
      .use-motion .comments,
      .use-motion .post-header,
      .use-motion .post-body,
      .use-motion .collection-header
      {
        opacity: initial;
      }

      .use-motion .site-title,
      .use-motion .site-subtitle
      {
        opacity: initial;
        top: initial;
      }

      .use-motion .logo-line-before i
      {
        left: initial;
      }

      .use-motion .logo-line-after i
      {
        right: initial;
      }

    </style>
  </noscript>
  <link rel="alternate" href="/atom.xml" title="静觅" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container">
    <div class="headband"></div>
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner">
        <div class="site-brand-container">
          <div class="site-nav-toggle">
            <div class="toggle" aria-label="切换导航栏">
              <span class="toggle-line toggle-line-first"></span>
              <span class="toggle-line toggle-line-middle"></span>
              <span class="toggle-line toggle-line-last"></span>
            </div>
          </div>
          <div class="site-meta">
            <a href="/" class="brand" rel="start">
              <span class="logo-line-before"><i></i></span>
              <h1 class="site-title">静觅 <span class="site-subtitle"> 崔庆才的个人站点 </span>
              </h1>
              <span class="logo-line-after"><i></i></span>
            </a>
          </div>
          <div class="site-nav-right">
            <div class="toggle popup-trigger">
              <i class="fa fa-search fa-fw fa-lg"></i>
            </div>
          </div>
        </div>
        <nav class="site-nav">
          <ul id="menu" class="main-menu menu">
            <li class="menu-item menu-item-home">
              <a href="/" rel="section">首页</a>
            </li>
            <li class="menu-item menu-item-archives">
              <a href="/archives/" rel="section">文章列表</a>
            </li>
            <li class="menu-item menu-item-tags">
              <a href="/tags/" rel="section">文章标签</a>
            </li>
            <li class="menu-item menu-item-categories">
              <a href="/categories/" rel="section">文章分类</a>
            </li>
            <li class="menu-item menu-item-about">
              <a href="/about/" rel="section">关于博主</a>
            </li>
            <li class="menu-item menu-item-message">
              <a href="/message/" rel="section">给我留言</a>
            </li>
            <li class="menu-item menu-item-search">
              <a role="button" class="popup-trigger">搜索 </a>
            </li>
          </ul>
        </nav>
        <div class="search-pop-overlay">
          <div class="popup search-popup">
            <div class="search-header">
              <span class="search-icon">
                <i class="fa fa-search"></i>
              </span>
              <div class="search-input-container">
                <input autocomplete="off" autocapitalize="off" placeholder="搜索..." spellcheck="false" type="search" class="search-input">
              </div>
              <span class="popup-btn-close">
                <i class="fa fa-times-circle"></i>
              </span>
            </div>
            <div id="search-result">
              <div id="no-result">
                <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
              </div>
            </div>
          </div>
        </div>
      </div>
    </header>
    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
      <span>0%</span>
    </div>
    <div class="reading-progress-bar"></div>
    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div class="content index posts-expand">
            <div class="carousel">
              <div id="wowslider-container">
                <div class="ws_images">
                  <ul>
                    <li><a target="_blank" href="https://cuiqingcai.com/5052.html"><img title="Python3网络爬虫开发实战教程" src="https://qiniu.cuiqingcai.com/ipy96.jpg" /></a></li>
                    <li><a target="_blank" href="https://t.lagou.com/fRCBRsRCSN6FA"><img title="52讲轻松搞定网络爬虫" src="https://qiniu.cuiqingcai.com/fqq5e.png" /></a></li>
                    <li><a target="_blank" href="https://brightdata.grsm.io/cuiqingcai"><img title="亮网络解锁器" src="https://qiniu.cuiqingcai.com/6qnb7.png" /></a></li>
                    <li><a target="_blank" href="https://cuiqingcai.com/4320.html"><img title="Python3网络爬虫开发视频教程" src="https://qiniu.cuiqingcai.com/bjrny.jpg" /></a></li>
                    <li><a target="_blank" href="https://cuiqingcai.com/5094.html"><img title="爬虫代理哪家强？十大付费代理详细对比评测出炉！" src="https://qiniu.cuiqingcai.com/nifs6.jpg" /></a></li>
                  </ul>
                </div>
                <div class="ws_thumbs">
                  <div>
                    <a target="_blank" href="#"><img src="https://qiniu.cuiqingcai.com/ipy96.jpg" /></a>
                    <a target="_blank" href="#"><img src="https://qiniu.cuiqingcai.com/fqq5e.png" /></a>
                    <a target="_blank" href="#"><img src="https://qiniu.cuiqingcai.com/6qnb7.png" /></a>
                    <a target="_blank" href="#"><img src="https://qiniu.cuiqingcai.com/bjrny.jpg" /></a>
                    <a target="_blank" href="#"><img src="https://qiniu.cuiqingcai.com/nifs6.jpg" /></a>
                  </div>
                </div>
                <div class="ws_shadow"></div>
              </div>
            </div>
            <link rel="stylesheet" href="/lib/wowslide/slide.css">
            <script src="/lib/wowslide/jquery.min.js"></script>
            <script src="/lib/wowslide/slider.js"></script>
            <script>
              jQuery("#wowslider-container").wowSlider(
              {
                effect: "cube",
                prev: "",
                next: "",
                duration: 20 * 100,
                delay: 20 * 100,
                width: 716,
                height: 297,
                autoPlay: true,
                playPause: true,
                stopOnHover: false,
                loop: false,
                bullets: 0,
                caption: true,
                captionEffect: "slide",
                controls: true,
                onBeforeStep: 0,
                images: 0
              });

            </script>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/954.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> Python <i class="label-arrow"></i>
                  </a>
                  <a href="/954.html" class="post-title-link" itemprop="url">Python爬虫入门四之Urllib库的高级用法</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <h2 id="1-设置Headers"><a href="#1-设置Headers" class="headerlink" title="1.设置Headers"></a>1.设置Headers</h2>
                  <p>有些网站不会同意程序直接用上面的方式进行访问，如果识别有问题，那么站点根本不会响应，所以为了完全模拟浏览器的工作，我们需要设置一些Headers 的属性。 首先，打开我们的浏览器，调试浏览器F12，我用的是Chrome，打开网络监听，示意如下，比如知乎，点登录之后，我们会发现登陆之后界面都变化了，出现一个新的界面，实质上这个页面包含了许许多多的内容，这些内容也不是一次性就加载完成的，实质上是执行了好多次请求，一般是首先请求HTML文件，然后加载JS，CSS 等等，经过多次请求之后，网页的骨架和肌肉全了，整个网页的效果也就出来了。 <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2015/02/2015-02-13-013155-的屏幕截图-e1423762350360.png" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2015/02/2015-02-13-013155-的屏幕截图-e1423762350360-1024x424.png" alt="2015-02-13 01:31:55 的屏幕截图"></a> 拆分这些请求，我们只看一第一个请求，你可以看到，有个Request URL，还有headers，下面便是response，图片显示得不全，小伙伴们可以亲身实验一下。那么这个头中包含了许许多多是信息，有文件编码啦，压缩方式啦，请求的agent啦等等。 其中，agent就是请求的身份，如果没有写入请求身份，那么服务器不一定会响应，所以可以在headers中设置agent,例如下面的例子，这个例子只是说明了怎样设置的headers，小伙伴们看一下设置格式就好。</p>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">import urllib  </span><br><span class="line">import urllib2  </span><br><span class="line"></span><br><span class="line">url = <span class="string">'http://www.server.com/login'</span></span><br><span class="line">user_agent = <span class="string">'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'</span>  </span><br><span class="line">values = &#123;<span class="string">'username'</span> : <span class="string">'cqc'</span>,  <span class="string">'password'</span> : <span class="string">'XXXX'</span> &#125;  </span><br><span class="line">headers = &#123; <span class="string">'User-Agent'</span> : user_agent &#125;  </span><br><span class="line">data = urllib.urlencode(values)  </span><br><span class="line">request = urllib2.Request(url, data, headers)  </span><br><span class="line">response = urllib2.urlopen(request)  </span><br><span class="line">page = response.read()</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>这样，我们设置了一个headers，在构建request时传入，在请求时，就加入了headers传送，服务器若识别了是浏览器发来的请求，就会得到响应。 另外，我们还有<strong>对付”反盗链”</strong>的方式，对付防盗链，服务器会识别headers中的referer是不是它自己，如果不是，有的服务器不会响应，所以我们还可以在headers中加入referer 例如我们可以构建下面的headers</p>
                  <figure class="highlight ebnf">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">headers</span> = &#123; <span class="string">'User-Agent'</span> : <span class="string">'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'</span>  ,</span><br><span class="line">                        <span class="string">'Referer'</span>:<span class="string">'http://www.zhihu.com/articles'</span> &#125;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>同上面的方法，在传送请求时把headers传入Request参数里，这样就能应付防盗链了。 另外headers的一些属性，下面的需要特别注意一下：</p>
                  <blockquote>
                    <p>User-Agent : 有些服务器或 Proxy 会通过该值来判断是否是浏览器发出的请求 Content-Type : 在使用 REST 接口时，服务器会检查该值，用来确定 HTTP Body 中的内容该怎样解析。 application/xml ： 在 XML RPC，如 RESTful/SOAP 调用时使用 application/json ： 在 JSON RPC 调用时使用 application/x-www-form-urlencoded ： 浏览器提交 Web 表单时使用 在使用服务器提供的 RESTful 或 SOAP 服务时， Content-Type 设置错误会导致服务器拒绝服务</p>
                  </blockquote>
                  <p>其他的有必要的可以审查浏览器的headers内容，在构建时写入同样的数据即可。</p>
                  <h2 id="2-Proxy（代理）的设置"><a href="#2-Proxy（代理）的设置" class="headerlink" title="2. Proxy（代理）的设置"></a><strong>2. Proxy（代理）的设置</strong></h2>
                  <p>urllib2 默认会使用环境变量 http_proxy 来设置 HTTP Proxy。假如一个网站它会检测某一段时间某个IP 的访问次数，如果访问次数过多，它会禁止你的访问。所以你可以设置一些代理服务器来帮助你做工作，每隔一段时间换一个代理，网站君都不知道是谁在捣鬼了，这酸爽！ 下面一段代码说明了代理的设置用法</p>
                  <figure class="highlight reasonml">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">import urllib2</span><br><span class="line">enable_proxy = True</span><br><span class="line">proxy_handler = urllib2.<span class="constructor">ProxyHandler(&#123;<span class="string">"http"</span> : '<span class="params">http</span>:<span class="operator">/</span><span class="operator">/</span><span class="params">some</span>-<span class="params">proxy</span>.<span class="params">com</span>:8080'&#125;)</span></span><br><span class="line">null_proxy_handler = urllib2.<span class="constructor">ProxyHandler(&#123;&#125;)</span></span><br><span class="line"><span class="keyword">if</span> enable_proxy:</span><br><span class="line">    opener = urllib2.build<span class="constructor">_opener(<span class="params">proxy_handler</span>)</span></span><br><span class="line"><span class="keyword">else</span>:</span><br><span class="line">    opener = urllib2.build<span class="constructor">_opener(<span class="params">null_proxy_handler</span>)</span></span><br><span class="line">urllib2.install<span class="constructor">_opener(<span class="params">opener</span>)</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h2 id="3-Timeout-设置"><a href="#3-Timeout-设置" class="headerlink" title="3.Timeout 设置"></a>3.<strong>Timeout 设置</strong></h2>
                  <p>上一节已经说过urlopen方法了，第三个参数就是timeout的设置，可以设置等待多久超时，为了解决一些网站实在响应过慢而造成的影响。 例如下面的代码,如果第二个参数data为空那么要特别指定是timeout是多少，写明形参，如果data已经传入，则不必声明。</p>
                  <figure class="highlight nix">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="built_in">import</span> urllib2</span><br><span class="line"><span class="attr">response</span> = urllib2.urlopen('http://www.baidu.com', <span class="attr">timeout=10)</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <figure class="highlight haskell">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="keyword">import</span> urllib2</span><br><span class="line"><span class="title">response</span> = urllib2.urlopen('http://www.baidu.com',<span class="class"><span class="keyword">data</span>, 10)</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h2 id="4-使用-HTTP-的-PUT-和-DELETE-方法"><a href="#4-使用-HTTP-的-PUT-和-DELETE-方法" class="headerlink" title="4.使用 HTTP 的 PUT 和 DELETE 方法"></a><strong>4.使用 HTTP 的 PUT 和 DELETE 方法</strong></h2>
                  <p>http协议有六种请求方法，get,head,put,delete,post,options，我们有时候需要用到PUT方式或者DELETE方式请求。</p>
                  <blockquote>
                    <p>PUT：这个方法比较少见。HTML表单也不支持这个。本质上来讲， PUT和POST极为相似，都是向服务器发送数据，但它们之间有一个重要区别，PUT通常指定了资源的存放位置，而POST则没有，POST的数据存放位置由服务器自己决定。 DELETE：删除某一个资源。基本上这个也很少见，不过还是有一些地方比如amazon的S3云服务里面就用的这个方法来删除资源。</p>
                  </blockquote>
                  <p>如果要使用 HTTP PUT 和 DELETE ，只能使用比较低层的 httplib 库。虽然如此，我们还是能通过下面的方式，使 urllib2 能够发出 PUT 或DELETE 的请求，不过用的次数的确是少，在这里提一下。</p>
                  <figure class="highlight nix">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="built_in">import</span> urllib2</span><br><span class="line"><span class="attr">request</span> = urllib2.Request(uri, <span class="attr">data=data)</span></span><br><span class="line">request.<span class="attr">get_method</span> = lambda: 'PUT' <span class="comment"># or 'DELETE'</span></span><br><span class="line"><span class="attr">response</span> = urllib2.urlopen(request)</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h2 id="5-使用DebugLog"><a href="#5-使用DebugLog" class="headerlink" title="5.使用DebugLog"></a>5.使用DebugLog</h2>
                  <p>可以通过下面的方法把 Debug Log 打开，这样收发包的内容就会在屏幕上打印出来，方便调试，这个也不太常用，仅提一下</p>
                  <figure class="highlight reasonml">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">import urllib2</span><br><span class="line">httpHandler = urllib2.<span class="constructor">HTTPHandler(<span class="params">debuglevel</span>=1)</span></span><br><span class="line">httpsHandler = urllib2.<span class="constructor">HTTPSHandler(<span class="params">debuglevel</span>=1)</span></span><br><span class="line">opener = urllib2.build<span class="constructor">_opener(<span class="params">httpHandler</span>, <span class="params">httpsHandler</span>)</span></span><br><span class="line">urllib2.install<span class="constructor">_opener(<span class="params">opener</span>)</span></span><br><span class="line">response = urllib2.urlopen('http:<span class="comment">//www.baidu.com')</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>以上便是一部分高级特性，前三个是重要内容，在后面，还有cookies的设置还有异常的处理，小伙伴们加油！</p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2015-02-13 02:12:57" itemprop="dateCreated datePublished" datetime="2015-02-13T02:12:57+08:00">2015-02-13</time>
                </span>
                <span id="/954.html" class="post-meta-item leancloud_visitors" data-flag-title="Python爬虫入门四之Urllib库的高级用法" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>3.2k</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>3 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/947.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> Python <i class="label-arrow"></i>
                  </a>
                  <a href="/947.html" class="post-title-link" itemprop="url">Python爬虫入门三之Urllib库的基本使用</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>那么接下来，小伙伴们就一起和我真正迈向我们的爬虫之路吧。</p>
                  <h2 id="1-分分钟扒一个网页下来"><a href="#1-分分钟扒一个网页下来" class="headerlink" title="1.分分钟扒一个网页下来"></a>1.分分钟扒一个网页下来</h2>
                  <p>怎样扒网页呢？其实就是根据URL来获取它的网页信息，虽然我们在浏览器中看到的是一幅幅优美的画面，但是其实是由浏览器解释才呈现出来的，实质它是一段HTML代码，加 JS、CSS，如果把网页比作一个人，那么HTML便是他的骨架，JS便是他的肌肉，CSS便是它的衣服。所以最重要的部分是存在于HTML中的，下面我们就写个例子来扒一个网页下来。</p>
                  <figure class="highlight arduino">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="keyword">import</span> urllib2</span><br><span class="line"></span><br><span class="line">response = urllib2.urlopen(<span class="string">"http://www.baidu.com"</span>)</span><br><span class="line"><span class="built_in">print</span> response.<span class="built_in">read</span>()</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>是的你没看错，真正的程序就两行，把它保存成 demo.py，进入该文件的目录，执行如下命令查看运行结果，感受一下。</p>
                  <figure class="highlight vim">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="keyword">python</span> demo.<span class="keyword">py</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p><a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2015/02/2015-02-13-000909-的屏幕截图.png" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2015/02/2015-02-13-000909-的屏幕截图.png" alt="2015-02-13 00:09:09 的屏幕截图"></a> 看，这个网页的源码已经被我们扒下来了，是不是很酸爽？</p>
                  <h2 id="2-分析扒网页的方法"><a href="#2-分析扒网页的方法" class="headerlink" title="2.分析扒网页的方法"></a>2.分析扒网页的方法</h2>
                  <p>那么我们来分析这两行代码，第一行</p>
                  <figure class="highlight ini">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attr">response</span> = urllib2.urlopen(<span class="string">"http://www.baidu.com"</span>)</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>首先我们调用的是urllib2库里面的urlopen方法，传入一个URL，这个网址是百度首页，协议是HTTP协议，当然你也可以把HTTP换做FTP,FILE,HTTPS 等等，只是代表了一种访问控制协议，urlopen一般接受三个参数，它的参数如下：</p>
                  <figure class="highlight stylus">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="function"><span class="title">urlopen</span><span class="params">(url, data, timeout)</span></span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>第一个参数url即为URL，第二个参数data是访问URL时要传送的数据，第三个timeout是设置超时时间。 第二三个参数是可以不传送的，data默认为空None，timeout默认为 socket._GLOBAL_DEFAULT_TIMEOUT 第一个参数URL是必须要传送的，在这个例子里面我们传送了百度的URL，执行urlopen方法之后，返回一个response对象，返回信息便保存在这里面。</p>
                  <figure class="highlight arduino">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="built_in">print</span> response.<span class="built_in">read</span>()</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>response对象有一个read方法，可以返回获取到的网页内容。</p>
                  <p>如果不加read直接打印会是什么？答案如下：</p>
                  <figure class="highlight mipsasm">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">&lt;<span class="keyword">addinfourl </span><span class="built_in">at</span> <span class="number">139728495260376</span> whose <span class="built_in">fp</span> = &lt;socket._fileobject object <span class="built_in">at</span> <span class="number">0x7f1513fb3ad0</span>&gt;&gt;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>直接打印出了该对象的描述，所以记得一定要加read方法，否则它不出来内容可就不怪我咯！</p>
                  <h2 id="3-构造Request"><a href="#3-构造Request" class="headerlink" title="3.构造Request"></a>3.构造Request</h2>
                  <p>其实上面的urlopen参数可以传入一个request请求,它其实就是一个Request类的实例，构造时需要传入Url,Data等等的内容。比如上面的两行代码，我们可以这么改写</p>
                  <figure class="highlight vbscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">import urllib2</span><br><span class="line"></span><br><span class="line"><span class="built_in">request</span> = urllib2.<span class="built_in">Request</span>(<span class="string">"http://www.baidu.com"</span>)</span><br><span class="line"><span class="built_in">response</span> = urllib2.urlopen(<span class="built_in">request</span>)</span><br><span class="line">print <span class="built_in">response</span>.read()</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>运行结果是完全一样的，只不过中间多了一个request对象，推荐大家这么写，因为在构建请求时还需要加入好多内容，通过构建一个request，服务器响应请求得到应答，这样显得逻辑上清晰明确。</p>
                  <h2 id="4-POST和GET数据传送"><a href="#4-POST和GET数据传送" class="headerlink" title="4.POST和GET数据传送"></a>4.POST和GET数据传送</h2>
                  <p>上面的程序演示了最基本的网页抓取，不过，现在大多数网站都是动态网页，需要你动态地传递参数给它，它做出对应的响应。所以，在访问时，我们需要传递数据给它。最常见的情况是什么？对了，就是登录注册的时候呀。 把数据用户名和密码传送到一个URL，然后你得到服务器处理之后的响应，这个该怎么办？下面让我来为小伙伴们揭晓吧！ 数据传送分为POST和GET两种方式，两种方式有什么区别呢？ 最重要的区别是GET方式是直接以链接形式访问，链接中包含了所有的参数，当然如果包含了密码的话是一种不安全的选择，不过你可以直观地看到自己提交了什么内容。POST则不会在网址上显示所有的参数，不过如果你想直接查看提交了什么就不太方便了，大家可以酌情选择。</p>
                  <h3 id="POST方式："><a href="#POST方式：" class="headerlink" title="POST方式："></a>POST方式：</h3>
                  <p>上面我们说了data参数是干嘛的？对了，它就是用在这里的，我们传送的数据就是这个参数data，下面演示一下POST方式。</p>
                  <figure class="highlight haskell">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="keyword">import</span> urllib</span><br><span class="line"><span class="keyword">import</span> urllib2</span><br><span class="line"></span><br><span class="line"><span class="title">values</span> = &#123;<span class="string">"username"</span>:<span class="string">"1016903103@qq.com"</span>,<span class="string">"password"</span>:<span class="string">"XXXX"</span>&#125;</span><br><span class="line"><span class="class"><span class="keyword">data</span> = urllib.urlencode(<span class="title">values</span>) </span></span><br><span class="line"><span class="title">url</span> = <span class="string">"https://passport.csdn.net/account/login?from=http://my.csdn.net/my/mycsdn"</span></span><br><span class="line"><span class="title">request</span> = urllib2.<span class="type">Request</span>(url,<span class="class"><span class="keyword">data</span>)</span></span><br><span class="line"><span class="title">response</span> = urllib2.urlopen(request)</span><br><span class="line"><span class="title">print</span> response.read()</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>我们引入了urllib库，现在我们模拟登陆CSDN，当然上述代码可能登陆不进去，因为CSDN还有个流水号的字段，没有设置全，比较复杂在这里就不写上去了，在此只是说明登录的原理。一般的登录网站一般是这种写法。 我们需要定义一个字典，名字为values，参数我设置了username和password，下面利用urllib的urlencode方法将字典编码，命名为data，构建request时传入两个参数，url和data，运行程序，返回的便是POST后呈现的页面内容。 注意上面字典的定义方式还有一种，下面的写法是等价的</p>
                  <figure class="highlight sql">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">import urllib</span><br><span class="line">import urllib2</span><br><span class="line"></span><br><span class="line"><span class="keyword">values</span> = &#123;&#125;</span><br><span class="line"><span class="keyword">values</span>[<span class="string">'username'</span>] = <span class="string">"1016903103@qq.com"</span></span><br><span class="line"><span class="keyword">values</span>[<span class="string">'password'</span>] = <span class="string">"XXXX"</span></span><br><span class="line"><span class="keyword">data</span> = urllib.urlencode(<span class="keyword">values</span>) </span><br><span class="line"><span class="keyword">url</span> = <span class="string">"http://passport.csdn.net/account/login?from=http://my.csdn.net/my/mycsdn"</span></span><br><span class="line">request = urllib2.Request(<span class="keyword">url</span>,<span class="keyword">data</span>)</span><br><span class="line">response = urllib2.urlopen(request)</span><br><span class="line">print response.read()</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>以上方法便实现了POST方式的传送</p>
                  <h3 id="GET方式："><a href="#GET方式：" class="headerlink" title="GET方式："></a>GET方式：</h3>
                  <p>至于GET方式我们可以直接把参数写到网址上面，直接构建一个带参数的URL出来即可。</p>
                  <figure class="highlight sql">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">import urllib</span><br><span class="line">import urllib2</span><br><span class="line"></span><br><span class="line"><span class="keyword">values</span>=&#123;&#125;</span><br><span class="line"><span class="keyword">values</span>[<span class="string">'username'</span>] = <span class="string">"1016903103@qq.com"</span></span><br><span class="line"><span class="keyword">values</span>[<span class="string">'password'</span>]=<span class="string">"XXXX"</span></span><br><span class="line"><span class="keyword">data</span> = urllib.urlencode(<span class="keyword">values</span>) </span><br><span class="line"><span class="keyword">url</span> = <span class="string">"http://passport.csdn.net/account/login"</span></span><br><span class="line">geturl = <span class="keyword">url</span> + <span class="string">"?"</span>+<span class="keyword">data</span></span><br><span class="line">request = urllib2.Request(geturl)</span><br><span class="line">response = urllib2.urlopen(request)</span><br><span class="line">print response.read()</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>你可以print geturl，打印输出一下url，发现其实就是原来的url加？然后加编码后的参数</p>
                  <figure class="highlight awk">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">http:<span class="regexp">//</span>passport.csdn.net<span class="regexp">/account/</span>login?username=<span class="number">1016903103</span>%<span class="number">40</span>qq.com&amp;password=XXXX</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>和我们平常GET访问方式一模一样，这样就实现了数据的GET方式传送。 本节讲解了一些基本使用，可以抓取到一些基本的网页信息，小伙伴们加油！</p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2015-02-13 01:48:23" itemprop="dateCreated datePublished" datetime="2015-02-13T01:48:23+08:00">2015-02-13</time>
                </span>
                <span id="/947.html" class="post-meta-item leancloud_visitors" data-flag-title="Python爬虫入门三之Urllib库的基本使用" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>3.2k</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>3 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/942.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> Python <i class="label-arrow"></i>
                  </a>
                  <a href="/942.html" class="post-title-link" itemprop="url">Python爬虫入门二之爬虫基础了解</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <h2 id="1-什么是爬虫"><a href="#1-什么是爬虫" class="headerlink" title="1.什么是爬虫"></a>1.什么是爬虫</h2>
                  <p>爬虫，即网络爬虫，大家可以理解为在网络上爬行的一直蜘蛛，互联网就比作一张大网，而爬虫便是在这张网上爬来爬去的蜘蛛咯，如果它遇到资源，那么它就会抓取下来。想抓取什么？这个由你来控制它咯。 比如它在抓取一个网页，在这个网中他发现了一条道路，其实就是指向网页的超链接，那么它就可以爬到另一张网上来获取数据。这样，整个连在一起的大网对这之蜘蛛来说触手可及，分分钟爬下来不是事儿。</p>
                  <h2 id="2-浏览网页的过程"><a href="#2-浏览网页的过程" class="headerlink" title="2.浏览网页的过程"></a>2.浏览网页的过程</h2>
                  <p>在用户浏览网页的过程中，我们可能会看到许多好看的图片，比如 <a href="http://image.baidu.com/" target="_blank" rel="noopener">http://image.baidu.com/</a> ，我们会看到几张的图片以及百度搜索框，这个过程其实就是用户输入网址之后，经过DNS服务器，找到服务器主机，向服务器发出一个请求，服务器经过解析之后，发送给用户的浏览器 HTML、JS、CSS 等文件，浏览器解析出来，用户便可以看到形形色色的图片了。 因此，用户看到的网页实质是由 HTML 代码构成的，爬虫爬来的便是这些内容，通过分析和过滤这些 HTML 代码，实现对图片、文字等资源的获取。</p>
                  <h2 id="3-URL的含义"><a href="#3-URL的含义" class="headerlink" title="3.URL的含义"></a>3.URL的含义</h2>
                  <p>URL，即统一资源定位符，也就是我们说的网址，统一资源定位符是对可以从互联网上得到的资源的位置和访问方法的一种简洁的表示，是互联网上标准资源的地址。互联网上的每个文件都有一个唯一的URL，它包含的信息指出文件的位置以及浏览器应该怎么处理它。</p>
                  <blockquote>
                    <p>URL的格式由三部分组成： ①第一部分是协议(或称为服务方式)。 ②第二部分是存有该资源的主机IP地址(有时也包括端口号)。 ③第三部分是主机资源的具体地址，如目录和文件名等。</p>
                  </blockquote>
                  <p>爬虫爬取数据时必须要有一个目标的URL才可以获取数据，因此，它是爬虫获取数据的基本依据，准确理解它的含义对爬虫学习有很大帮助。</p>
                  <h2 id="4-环境的配置"><a href="#4-环境的配置" class="headerlink" title="4. 环境的配置"></a>4. 环境的配置</h2>
                  <p>学习Python，当然少不了环境的配置，最初我用的是Notepad++，不过发现它的提示功能实在是太弱了，于是，在Windows下我用了PyCharm，在Linux下我用了Eclipse for Python，另外还有几款比较优秀的IDE，大家可以参考这篇文章 <a href="http://www.oschina.net/news/57468/best-python-ide-for-developers" target="_blank" rel="noopener">学习Python推荐的IDE</a> 。好的开发工具是前进的推进器，希望大家可以找到适合自己的IDE 下一节，我们就正式步入 Python 爬虫学习的殿堂了，小伙伴准备好了嘛？</p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2015-02-12 23:45:29" itemprop="dateCreated datePublished" datetime="2015-02-12T23:45:29+08:00">2015-02-12</time>
                </span>
                <span id="/942.html" class="post-meta-item leancloud_visitors" data-flag-title="Python爬虫入门二之爬虫基础了解" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>932</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>1 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/927.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> Python <i class="label-arrow"></i>
                  </a>
                  <a href="/927.html" class="post-title-link" itemprop="url">Python爬虫入门一之综述</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>大家好哈，最近博主在学习Python，学习期间也遇到一些问题，获得了一些经验，在此将自己的学习系统地整理下来，如果大家有兴趣学习爬虫的话，可以将这些文章作为参考，也欢迎大家一共分享学习经验。 Python版本:2.7，Python 3请另寻其他博文。 首先爬虫是什么？</p>
                  <blockquote>
                    <p>网络爬虫（又被称为网页蜘蛛，网络机器人，在FOAF社区中间，更经常的称为网页追逐者），是一种按照一定的规则，自动的抓取万维网信息的程序或者脚本。</p>
                  </blockquote>
                  <p>根据我的经验，要学习Python爬虫，我们要学习的共有以下几点：</p>
                  <ul>
                    <li>Python基础知识</li>
                    <li>Python中urllib和urllib2库的用法</li>
                    <li>Python正则表达式</li>
                    <li>Python爬虫框架Scrapy</li>
                    <li>Python爬虫更高级的功能</li>
                  </ul>
                  <h2 id="1-Python基础学习"><a href="#1-Python基础学习" class="headerlink" title="1.Python基础学习"></a>1.Python基础学习</h2>
                  <p>首先，我们要用Python写爬虫，肯定要了解Python的基础吧，万丈高楼平地起，不能忘啦那地基，哈哈，那么我就分享一下自己曾经看过的一些Python教程，小伙伴们可以作为参考。</p>
                  <h3 id="1-慕课网Python教程"><a href="#1-慕课网Python教程" class="headerlink" title="1) 慕课网Python教程"></a>1) 慕课网Python教程</h3>
                  <p>曾经有一些基础的语法是在慕课网上看的，上面附有一些练习，学习完之后可以作为练习，感觉效果还是蛮不错的，不过稍微遗憾的是内容基本上都是最基础的，入门开始的话，就这个吧 学习网址：<a href="http://www.imooc.com/view/177" target="_blank" rel="noopener">慕课网Python教程</a></p>
                  <h3 id="2-廖雪峰Python教程"><a href="#2-廖雪峰Python教程" class="headerlink" title="2) 廖雪峰Python教程"></a>2) 廖雪峰Python教程</h3>
                  <p>后来，我发现了廖老师的Python教程，讲的那是非常通俗易懂哪，感觉也是非常不错，大家如果想进一步了解Python就看一下这个吧。 学习网址：<a href="http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000" target="_blank" rel="noopener">廖雪峰Python教程</a></p>
                  <h3 id="3-简明Python教程"><a href="#3-简明Python教程" class="headerlink" title="3) 简明Python教程"></a>3) 简明Python教程</h3>
                  <p>还有一个我看过的，简明Python教程，感觉讲的也不错 学习网址：<a href="http://woodpecker.org.cn/abyteofpython_cn/chinese/pr01.html#s01" target="_blank" rel="noopener">简明Python教程</a></p>
                  <h3 id="4-汪海的实验室"><a href="#4-汪海的实验室" class="headerlink" title="4) 汪海的实验室"></a>4) 汪海的实验室</h3>
                  <p>这是我的本科实验室学长，入门的时候参考的他的文章，自己重新做了总结，后来这些系列文章又在他的基础上增加了一些内容。 学习网址：<a href="http://blog.csdn.net/wxg694175346/article/category/1418998/1" target="_blank" rel="noopener">汪海的实验室</a></p>
                  <h2 id="2-Python-urllib和urllib2-库的用法"><a href="#2-Python-urllib和urllib2-库的用法" class="headerlink" title="2.Python urllib和urllib2 库的用法"></a>2.Python urllib和urllib2 库的用法</h2>
                  <p>urllib和urllib2库是学习Python爬虫最基本的库，利用这个库我们可以得到网页的内容，并对内容用正则表达式提取分析，得到我们想要的结果。这个在学习过程中我会和大家分享的。</p>
                  <h2 id="3-Python-正则表达式"><a href="#3-Python-正则表达式" class="headerlink" title="3.Python 正则表达式"></a>3.Python 正则表达式</h2>
                  <p>Python正则表达式是一种用来匹配字符串的强有力的武器。它的设计思想是用一种描述性的语言来给字符串定义一个规则，凡是符合规则的字符串，我们就认为它“匹配”了，否则，该字符串就是不合法的。这个在后面的博文会分享的。</p>
                  <h2 id="4-爬虫框架Scrapy"><a href="#4-爬虫框架Scrapy" class="headerlink" title="4.爬虫框架Scrapy"></a>4.爬虫框架Scrapy</h2>
                  <p>如果你是一个Python高手，基本的爬虫知识都已经掌握了，那么就寻觅一下Python框架吧，我选择的框架是Scrapy框架。这个框架有什么强大的功能呢？下面是它的官方介绍：</p>
                  <blockquote>
                    <p>HTML, XML源数据 选择及提取 的内置支持 提供了一系列在spider之间共享的可复用的过滤器(即 Item Loaders)，对智能处理爬取数据提供了内置支持。 通过 feed导出 提供了多格式(JSON、CSV、XML)，多存储后端(FTP、S3、本地文件系统)的内置支持 提供了media pipeline，可以 自动下载 爬取到的数据中的图片(或者其他资源)。 高扩展性。您可以通过使用 signals ，设计好的API(中间件, extensions, pipelines)来定制实现您的功能。 内置的中间件及扩展为下列功能提供了支持: cookies and session 处理 HTTP 压缩 HTTP 认证 HTTP 缓存 user-agent模拟 robots.txt 爬取深度限制 针对非英语语系中不标准或者错误的编码声明, 提供了自动检测以及健壮的编码支持。 支持根据模板生成爬虫。在加速爬虫创建的同时，保持在大型项目中的代码更为一致。详细内容请参阅 genspider 命令。 针对多爬虫下性能评估、失败检测，提供了可扩展的 状态收集工具 。 提供 交互式shell终端 , 为您测试XPath表达式，编写和调试爬虫提供了极大的方便 提供 System service, 简化在生产环境的部署及运行 内置 Web service, 使您可以监视及控制您的机器 内置 Telnet终端 ，通过在Scrapy进程中钩入Python终端，使您可以查看并且调试爬虫 Logging 为您在爬取过程中捕捉错误提供了方便 支持 Sitemaps 爬取 具有缓存的DNS解析器</p>
                  </blockquote>
                  <p>官方文档：<a href="http://doc.scrapy.org/en/latest/" target="_blank" rel="noopener">http://doc.scrapy.org/en/latest/</a> 等我们掌握了基础的知识，再用这个 Scrapy 框架吧！ 扯了这么多，好像没多少有用的东西额，那就不扯啦！ 下面开始我们正式进入爬虫之旅吧！</p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2015-02-12 15:35:17" itemprop="dateCreated datePublished" datetime="2015-02-12T15:35:17+08:00">2015-02-12</time>
                </span>
                <span id="/927.html" class="post-meta-item leancloud_visitors" data-flag-title="Python爬虫入门一之综述" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>1.8k</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>2 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/932.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> Linux <i class="label-arrow"></i>
                  </a>
                  <a href="/932.html" class="post-title-link" itemprop="url">关于Ubuntu开机显示running in low-graphics 问题的解决办法</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>最近一直在学习ubuntu，今天重装了系统，开机出现running in low-graphics mode 问题。 解决办法如下： 第一步：在出现running in low-graphics的界面右下角，有一个OK按钮，点击后有四个选项 第二步：随便点击一个选项可以进入tty1文字输入终端，但不可以进入图形界面 第三步：输入用户名和密码，再输入sudo apt-get install fglrx, Y／N选择Y，等待安装成功，再输入reboot重启之后，就可以正常进入了 以上是我遇到后的解决办法，有更好的解决办法，还请多多指教</p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/Tiramisu" class="author" itemprop="url" rel="index">Tiramisu</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2015-02-11 23:02:14" itemprop="dateCreated datePublished" datetime="2015-02-11T23:02:14+08:00">2015-02-11</time>
                </span>
                <span id="/932.html" class="post-meta-item leancloud_visitors" data-flag-title="关于Ubuntu开机显示running in low-graphics 问题的解决办法" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>253</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>1 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/930.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> Linux <i class="label-arrow"></i>
                  </a>
                  <a href="/930.html" class="post-title-link" itemprop="url">在Win7下格式化Ubuntu分区，开机出现grub rescue解决办法</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>电脑是双系统，在win7系统下的磁盘管理中，格式化ubuntu分区，开机出现grub rescue。win7系统是完好的，但是进不去。 原因是开机引导出现问题，具体原因在这里不再详述。以下是解决办法 第一步：输入ls出现（hd0,msods1),（hd0,msdos5),（hd0,msods6),（hd0,msods7)，不同的电脑不一样，这是我电脑中的磁盘分区 第二步：输入set，查看现在电脑的root 和prefix所在的位置 第三步：查找你的grub目录（当然如果你知道你grub目录在哪里更好） 查找方法输入ls/(hd0,msdos1) 再按enter看看有没有boot文件夹，如果没有，就输入ls/(hd0,msdos5)等等，依次类推。。。 这里输入（hd0，madosX)是根据你输入ls出现的磁盘分区来输入的 第四步：找到boot文件夹在哪里之后，假设在（hd0,msdos7)中， 输入set root=(hd0,msdos7), 输入set prefix=（hd0，msdos7)/boot/grub 输入insmod normal 输入normal 第五步：之后回车之后应该出现启动界面，如果没有正常启动，文章后边有解决办法 如果正常启动，可以进入linux界面，输入sudo update-grub，回车 第六步：再输入sudo grub-install /dev/sda ，回车 第七步：最后输入reboot 还有一种情况，就是输入insmod normal显示找不到文件，可以选择制作ubuntu开机引导盘，重装ubuntu，不用担心，我们的win7系统还在，重装重启后，就可以看到我们熟悉的系统选择界面，有WIN7还有ubuntu，这样你就可以任意选择你想要进入的系统了。 有不足的地方，请多多指教。</p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/Tiramisu" class="author" itemprop="url" rel="index">Tiramisu</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2015-02-10 23:04:41" itemprop="dateCreated datePublished" datetime="2015-02-10T23:04:41+08:00">2015-02-10</time>
                </span>
                <span id="/930.html" class="post-meta-item leancloud_visitors" data-flag-title="在Win7下格式化Ubuntu分区，开机出现grub rescue解决办法" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>740</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>1 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/829.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> PHP <i class="label-arrow"></i>
                  </a>
                  <a href="/829.html" class="post-title-link" itemprop="url">WordPress自定义登录注册界面样式及LOGO</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>WordPress主题做好了，但是登录界面还是原生的样子，带有WordPress的图标，现在我们想把Logo自定义成我们想要的样子。 原来的登录界面如下： <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2015/02/QQ截图20150204161421.jpg" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2015/02/QQ截图20150204161421.jpg" alt="QQ截图20150204161421"></a> 现在开始，我们将把WordPress图标换做我们自定义的LOGO，首先要明确的是我们不能修改WordPress的源代码，因为如果有版本更新之类的操作，这个效果就找不到了，所以我们需要在主题下修改。 1.修改主题下的 functions.php 文件 在主题的最后面加入下面的代码，来引入一个CSS文件</p>
                  <figure class="highlight php">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="comment">/* 登陆界面图标 */</span></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">custom_login</span><span class="params">()</span> </span>&#123; </span><br><span class="line"> <span class="keyword">echo</span> <span class="string">'&lt;link rel="stylesheet" tyssspe="text/css" href="'</span> . get_bloginfo(<span class="string">'template_directory'</span>) . <span class="string">'/login/icon.css" /&gt;'</span>; &#125; </span><br><span class="line"> add_action(<span class="string">'login_head'</span>, <span class="string">'custom_login'</span>);</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>也就是引入了 login 目录下的 icon.css 样式表。 2.新建 icon.css 文件 在主题目录下新建 login文件夹，然后新建 icon.css 文件，编码为UTF-8，然后拖入我们自定义的LOGO，命名为 logo.png login目录里面是这样子的 <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2015/02/QQ截图20150204162536.jpg" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2015/02/QQ截图20150204162536.jpg" alt="QQ截图20150204162536"></a> 我的网站自定义的logo如下 <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2015/02/logo.png" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2015/02/logo.png" alt="logo"></a> 大家可以自己设计好的LOGO放入login目录下 在 icon.css 中加入如下代码</p>
                  <figure class="highlight css">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="selector-class">.login</span> <span class="selector-tag">h1</span> <span class="selector-tag">a</span> &#123;</span><br><span class="line"> <span class="attribute">background-image</span>: <span class="built_in">url</span>(<span class="string">'logo.png'</span>);</span><br><span class="line"> <span class="attribute">height</span>: <span class="number">100px</span>;</span><br><span class="line"> <span class="attribute">width</span>: <span class="number">230px</span>;</span><br><span class="line"> <span class="attribute">background-size</span>: <span class="number">230px</span>;</span><br><span class="line">&#125;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>在以上代码中设定了背景图和宽高度还有背景图片的大小即可。 如果想添加其他样式，只要在 icon.css 文件中加入样式就好。 三、刷新预览 修改完之后，我们预览一下，大功告成啦！ 效果图如下 <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2015/02/QQ截图20150204162703.jpg" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2015/02/QQ截图20150204162703.jpg" alt="QQ截图20150204162703"></a> 酷酷哒！小伙伴们快来尝试一下吧！</p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2015-02-04 16:32:42" itemprop="dateCreated datePublished" datetime="2015-02-04T16:32:42+08:00">2015-02-04</time>
                </span>
                <span id="/829.html" class="post-meta-item leancloud_visitors" data-flag-title="WordPress自定义登录注册界面样式及LOGO" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>812</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>1 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/809.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> PHP <i class="label-arrow"></i>
                  </a>
                  <a href="/809.html" class="post-title-link" itemprop="url">WordPress中去掉CSS文件后的参数，解决修改样式不生效的问题</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <h2 id="一、移除主题中的样式版本号"><a href="#一、移除主题中的样式版本号" class="headerlink" title="一、移除主题中的样式版本号"></a>一、移除主题中的样式版本号</h2>
                  <p>在更新新版本之后，发现WordPress中的JS和CSS文件引入时带有ver参数，在浏览器中审查元素或者 F12 查看其引入的文件，就如图中一样，文件的末尾会带有一个这样的参数，这样带来的麻烦有很多。很大的问题就是 修改style.css 文件不生效，它带有这个参数的作用就会让浏览器加载缓存的 JS 和 CSS 文件，而你修改了样式之后它还是不会生效。 <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2015/02/0150201161853.jpg" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2015/02/0150201161853.jpg" alt="0150201161853"></a> 那么这个怎么去除？ 找到你的主题文件中的 functions.php 文件 找到类似于下面的代码：</p>
                  <figure class="highlight reasonml">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">wp<span class="constructor">_register_script( '<span class="params">jquery</span>','<span class="operator">/</span><span class="operator">/</span><span class="params">libs</span>.<span class="params">baidu</span>.<span class="params">com</span><span class="operator">/</span><span class="params">jquery</span><span class="operator">/</span>1.8.3<span class="operator">/</span><span class="params">jquery</span>.<span class="params">min</span>.<span class="params">js</span>', <span class="params">false</span>,'1.0')</span>;</span><br><span class="line">wp<span class="constructor">_enqueue_script( '<span class="params">jquery</span>' )</span>;</span><br><span class="line">wp<span class="constructor">_register_script( '<span class="params">default</span>', <span class="params">get_template_directory_uri</span>()</span> . '/js/jquery.js', <span class="literal">false</span>, '<span class="number">1.0</span>', dopt('d_jquerybom_b') ? <span class="literal">true</span> : <span class="literal">false</span> ); </span><br><span class="line">wp<span class="constructor">_enqueue_script( '<span class="params">default</span>' )</span>; </span><br><span class="line">wp<span class="constructor">_register_style( '<span class="params">style</span>', <span class="params">get_template_directory_uri</span>()</span> . '/style.css',<span class="literal">false</span>,'<span class="number">1.0</span>');</span><br><span class="line">wp<span class="constructor">_enqueue_style( '<span class="params">style</span>' )</span>;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>你可以查找这几个函数名来找到。 你可以发现倒数第二行，引入了 style.css 文件，那么第四个参数就是罪魁祸首了，就是文件的版本号，把第四个参数修改为 null 即可，记住不要加引号的 null</p>
                  <figure class="highlight actionscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">wp_register_style( <span class="string">'style'</span>, get_template_directory_uri() . <span class="string">'/style.css'</span>,<span class="literal">false</span>,<span class="literal">null</span>);</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>这样刷新页面，你就会发现 style.css 样式表后面的参数就不见啦。 同样的道理，对于 JS文件，你同样可以通过修改第四个参数来解决问题。</p>
                  <h2 id="二、移除主题之外样式版本号"><a href="#二、移除主题之外样式版本号" class="headerlink" title="二、移除主题之外样式版本号"></a>二、移除主题之外样式版本号</h2>
                  <p>除了主题之内的CSS和JS带有版本号，主题之外的界面也带有版本号，比如登录界面等等，如果你想定制一个个性化的登录界面，那么你可以修改 wp-admin 目录下的css样式。但是，修改完之后仍然存在不生效的问题。这个怎么办？ 如下图所示，<a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2015/02/150204145120.jpg" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2015/02/150204145120-1024x505.jpg" alt="150204145120"></a> 审查该登录界面的元素，你会发现它的CSS样式仍然带有版本号，这会导致我们不管怎样修改 login.min.css 仍不会生效，那么我们就分析一下源代码。 我从 wp-admin 目录下找到了 load-styles.php 文件，它正是加载 CSS样式所必备的文件，但是和上面的主题中加载CSS文件的方式不同，它并不存在 wp_register_style 这个方法，不过我发现，它引入了一个 version.php 文件，代码如下：</p>
                  <figure class="highlight lisp">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">require( <span class="name">ABSPATH</span> . WPINC . '/version.php' )<span class="comment">;</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>那么它的路径在哪里，我们会发现 ABSPATH和 WPINC两个变量，这是两个宏定义</p>
                  <figure class="highlight lisp">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">define( 'ABSPATH', dirname(<span class="name">dirname</span>(<span class="name">__FILE__</span>)) . '/' )<span class="comment">;</span></span><br><span class="line">define( 'WPINC', 'wp-includes' )<span class="comment">;</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>顺藤摸瓜，我们找到了 wp-includes 目录下的 version.php 文件，其中就定义了版本号这个变量</p>
                  <figure class="highlight arcade">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="symbol">$wp</span>_version = <span class="string">'4.0.1'</span>;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>根据上面的思路，我们只需要把 version 改成null即可，试一下。这个方法不算好，去掉版本号之后一些插件可能识别有问题，请谨慎修改。</p>
                  <figure class="highlight arcade">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="symbol">$wp</span>_version = <span class="literal">null</span>;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>再来审查一下元素，我们就已经发现，版本号的后缀不见啦。 <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2015/02/QQ截图20150204145920.jpg" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2015/02/QQ截图20150204145920.jpg" alt="QQ截图20150204145920"></a> 我们之前修改的样式也已经生效了！如果还有更好的方法，欢迎补充！ 以上只是我的一些拙见，希望对大家有帮助！</p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2015-02-01 16:30:40" itemprop="dateCreated datePublished" datetime="2015-02-01T16:30:40+08:00">2015-02-01</time>
                </span>
                <span id="/809.html" class="post-meta-item leancloud_visitors" data-flag-title="WordPress中去掉CSS文件后的参数，解决修改样式不生效的问题" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>1.6k</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>1 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/806.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> Python <i class="label-arrow"></i>
                  </a>
                  <a href="/806.html" class="post-title-link" itemprop="url">Python字符串的相关操作</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <h2 id="1-大小写转换"><a href="#1-大小写转换" class="headerlink" title="1.大小写转换"></a>1.大小写转换</h2>
                  <p>判断字符串</p>
                  <figure class="highlight 1c">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">s.isalnum() <span class="meta">#所有字符都是数字或者字母</span></span><br><span class="line">s.isalpha() <span class="meta">#所有字符都是字母</span></span><br><span class="line">s.isdigit() <span class="meta">#所有字符都是数字</span></span><br><span class="line">s.islower() <span class="meta">#所有字符都是小写</span></span><br><span class="line">s.isupper() <span class="meta">#所有字符都是大写</span></span><br><span class="line">s.istitle() <span class="meta">#所有单词都是首字母大写，像标题</span></span><br><span class="line">s.isspace() <span class="meta">#所有字符都是空白字符、\t、\n</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>大小写转换</p>
                  <figure class="highlight livecodeserver">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">s.<span class="built_in">upper</span>() <span class="comment">#把所有字符中的小写字母转换成大写字母</span></span><br><span class="line">s.<span class="built_in">lower</span>() <span class="comment">#把所有字符中的大写字母转换成小写字母</span></span><br><span class="line">s.capitalize()  <span class="comment">#把第一个字母转化为大写字母，其余小写</span></span><br><span class="line">s.title()  <span class="comment">#把每个单词的第一个字母转化为大写，其余小写</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2015-02-01 15:49:40" itemprop="dateCreated datePublished" datetime="2015-02-01T15:49:40+08:00">2015-02-01</time>
                </span>
                <span id="/806.html" class="post-meta-item leancloud_visitors" data-flag-title="Python字符串的相关操作" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>307</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>1 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/792.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> Python <i class="label-arrow"></i>
                  </a>
                  <a href="/792.html" class="post-title-link" itemprop="url">Python学习基础知识概要</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <h2 id="1-输入输出"><a href="#1-输入输出" class="headerlink" title="1.输入输出"></a>1.输入输出</h2>
                  <p>输出实例</p>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="builtin-name">print</span> <span class="string">'hello'</span>,<span class="string">'world'</span></span><br><span class="line">hello world</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>输入实例</p>
                  <figure class="highlight applescript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="built_in">name</span> = raw_input();</span><br><span class="line">print <span class="string">"hello,"</span>,<span class="built_in">name</span></span><br><span class="line"></span><br><span class="line">world</span><br><span class="line">hello,world</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>输入时提示实例</p>
                  <figure class="highlight reasonml">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">name = raw<span class="constructor">_input('<span class="params">please</span> <span class="params">enter</span> <span class="params">your</span> <span class="params">name</span>:')</span>;</span><br><span class="line">print <span class="string">"hello,"</span>,name</span><br><span class="line"></span><br><span class="line">please enter your name:world</span><br><span class="line">hello,world</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>raw_input 函数读入的是字符串，如果想要转换成int类型，就要用到int函数。</p>
                  <figure class="highlight isbl">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="variable">birth</span> = <span class="function"><span class="title">int</span>(<span class="title">raw_input</span>(<span class="string">'birth: '</span>))</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h2 id="2-字符表示"><a href="#2-字符表示" class="headerlink" title="2.字符表示"></a>2.字符表示</h2>
                  <p>十进制正常表示，十六进制最前面加 0x，小数正常表示，科学计数法表示 1.23x109就是1.23e9，或者 12.3e8 转义符 \ 转义符实例：</p>
                  <figure class="highlight livescript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">&gt;&gt;&gt; <span class="built_in">print</span> <span class="string">'\\\n\\'</span></span><br><span class="line"><span class="string">\</span></span><br><span class="line"><span class="string">\</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>防止转义，可以在前面加入 r</p>
                  <figure class="highlight python">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">&gt;&gt;&gt; </span><span class="keyword">print</span> <span class="string">'\\\t\\'</span></span><br><span class="line">\       \</span><br><span class="line"><span class="meta">&gt;&gt;&gt; </span><span class="keyword">print</span> <span class="string">r'\\\t\\'</span></span><br><span class="line">\\\t\\</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>多行内容表示，用三引号包括</p>
                  <figure class="highlight python">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">&gt;&gt;&gt; </span><span class="keyword">print</span> <span class="string">'''line1</span></span><br><span class="line"><span class="string"><span class="meta">... </span>line2</span></span><br><span class="line"><span class="string"><span class="meta">... </span>line3'''</span></span><br><span class="line">line1</span><br><span class="line">line2</span><br><span class="line">line3</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>布尔值的表示 True 和 False</p>
                  <figure class="highlight yaml">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="string">&gt;&gt;&gt;</span> <span class="number">3</span> <span class="string">&gt;</span> <span class="number">2</span></span><br><span class="line"><span class="literal">True</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>空值 None，相当于Java，C 中的 null</p>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">&gt;&gt;&gt;<span class="builtin-name">print</span> <span class="attribute">None</span>==None</span><br><span class="line"><span class="literal">True</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>Unicode表示的字符串用 u’…’ 表示，转化成 UTF-8 编码</p>
                  <figure class="highlight python">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">&gt;&gt;&gt; </span><span class="string">u'ABC'</span>.encode(<span class="string">'utf-8'</span>)</span><br><span class="line"><span class="string">'ABC'</span></span><br><span class="line"><span class="meta">&gt;&gt;&gt; </span><span class="string">u'中文'</span>.encode(<span class="string">'utf-8'</span>)</span><br><span class="line"><span class="string">'\xe4\xb8\xad\xe6\x96\x87'</span>&gt;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>文本文件编码</p>
                  <figure class="highlight d">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">#!/usr/bin/env python</span></span><br><span class="line"># -*- coding: utf-<span class="number">8</span> -*-</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h2 id="3-格式化"><a href="#3-格式化" class="headerlink" title="3.格式化"></a>3.格式化</h2>
                  <p>格式化输出实例</p>
                  <figure class="highlight ruby">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">&gt;&gt;</span>&gt; <span class="string">'Hello, %s'</span> % <span class="string">'world'</span></span><br><span class="line"><span class="string">'Hello, world'</span></span><br><span class="line"><span class="meta">&gt;&gt;</span>&gt; <span class="string">'Hi, %s, you have $%d.'</span> % (<span class="string">'Michael'</span>, <span class="number">1000000</span>)</span><br><span class="line"><span class="string">'Hi, Michael, you have $1000000.'</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>格式化整数和小数</p>
                  <figure class="highlight lsl">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">&gt;&gt;&gt; '%<span class="number">2</span>d-%<span class="number">02</span>d' % (<span class="number">3</span>, <span class="number">1</span>)</span><br><span class="line">' <span class="number">3</span><span class="number">-01</span>'</span><br><span class="line">&gt;&gt;&gt; '%<span class="number">.2</span>f' % <span class="number">3.1415926</span></span><br><span class="line">'<span class="number">3.14</span>'</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>万能格式化 %s，可以代替所有格式化 对于Unicode字符串，用法完全一样，但最好确保替换的字符串也是Unicode字符串：</p>
                  <figure class="highlight python">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">&gt;&gt;&gt; </span><span class="string">u'Hi, %s'</span> % <span class="string">u'Michael'</span></span><br><span class="line"><span class="string">u'Hi, Michael'</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>输出百分号 %，用双 % 即可</p>
                  <figure class="highlight ruby">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">&gt;&gt;</span>&gt; <span class="string">'growth rate: %d %%'</span> % <span class="number">7</span></span><br><span class="line"><span class="string">'growth rate: 7 %'</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h2 id="4-列表-list"><a href="#4-列表-list" class="headerlink" title="4.列表 list"></a>4.列表 list</h2>
                  <p>列表 list ，可变的有序表</p>
                  <figure class="highlight ruby">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">&gt;&gt;</span>&gt; classmates = [<span class="string">'Michael'</span>, <span class="string">'Bob'</span>, <span class="string">'Tracy'</span>]</span><br><span class="line"><span class="meta">&gt;&gt;</span>&gt; classmates</span><br><span class="line">[<span class="string">'Michael'</span>, <span class="string">'Bob'</span>, <span class="string">'Tracy'</span>]</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>len函数获取它的长度</p>
                  <figure class="highlight ruby">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">&gt;&gt;</span>&gt; len(classmates)</span><br><span class="line"><span class="number">3</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>取得某个元素，可以用中括号索引</p>
                  <figure class="highlight ruby">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">&gt;&gt;</span>&gt; classmates[<span class="number">0</span>]</span><br><span class="line"><span class="string">'Michael'</span></span><br><span class="line"><span class="meta">&gt;&gt;</span>&gt; classmates[<span class="number">1</span>]</span><br><span class="line"><span class="string">'Bob'</span></span><br><span class="line"><span class="meta">&gt;&gt;</span>&gt; classmates[<span class="number">2</span>]</span><br><span class="line"><span class="string">'Tracy'</span></span><br><span class="line"><span class="meta">&gt;&gt;</span>&gt; classmates[<span class="number">3</span>]</span><br><span class="line">Traceback (most recent call last)<span class="symbol">:</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>倒数索引</p>
                  <figure class="highlight ruby">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">&gt;&gt;</span>&gt; classmates[-<span class="number">1</span>]</span><br><span class="line"><span class="string">'Tracy'</span></span><br><span class="line"><span class="meta">&gt;&gt;</span>&gt; classmates[-<span class="number">2</span>]</span><br><span class="line"><span class="string">'Bob'</span></span><br><span class="line"><span class="meta">&gt;&gt;</span>&gt; classmates[-<span class="number">3</span>]</span><br><span class="line"><span class="string">'Michael'</span></span><br><span class="line"><span class="meta">&gt;&gt;</span>&gt; classmates[-<span class="number">4</span>]</span><br><span class="line">Traceback (most recent call last)<span class="symbol">:</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>append 追加元素到末尾</p>
                  <figure class="highlight ruby">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">&gt;&gt;</span>&gt; classmates.append(<span class="string">'Adam'</span>)</span><br><span class="line"><span class="meta">&gt;&gt;</span>&gt; classmates</span><br><span class="line">[<span class="string">'Michael'</span>, <span class="string">'Bob'</span>, <span class="string">'Tracy'</span>, <span class="string">'Adam'</span>]</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>insert 插入到指定位置</p>
                  <figure class="highlight ruby">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">&gt;&gt;</span>&gt;&gt; classmates.insert(<span class="number">1</span>, <span class="string">'Jack'</span>)</span><br><span class="line"><span class="meta">&gt;&gt;</span>&gt; classmates</span><br><span class="line">[<span class="string">'Michael'</span>, <span class="string">'Jack'</span>, <span class="string">'Bob'</span>, <span class="string">'Tracy'</span>, <span class="string">'Adam'</span>]</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>pop 删除末尾元素</p>
                  <figure class="highlight ruby">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">&gt;&gt;</span>&gt; classmates.pop()</span><br><span class="line"><span class="string">'Adam'</span></span><br><span class="line"><span class="meta">&gt;&gt;</span>&gt; classmates</span><br><span class="line">[<span class="string">'Michael'</span>, <span class="string">'Jack'</span>, <span class="string">'Bob'</span>, <span class="string">'Tracy'</span>]</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>pop 加入参数删除指定元素</p>
                  <figure class="highlight ruby">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">&gt;&gt;</span>&gt; classmates.pop(<span class="number">1</span>)</span><br><span class="line"><span class="string">'Jack'</span></span><br><span class="line"><span class="meta">&gt;&gt;</span>&gt; classmates</span><br><span class="line">[<span class="string">'Michael'</span>, <span class="string">'Bob'</span>, <span class="string">'Tracy'</span>]</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>元素改变，直接赋值即可</p>
                  <figure class="highlight ruby">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">&gt;&gt;</span>&gt; classmates[<span class="number">1</span>] = <span class="string">'Sarah'</span></span><br><span class="line"><span class="meta">&gt;&gt;</span>&gt; classmates</span><br><span class="line">[<span class="string">'Michael'</span>, <span class="string">'Sarah'</span>, <span class="string">'Tracy'</span>]</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>list可以嵌套，可用二维索引</p>
                  <figure class="highlight markdown">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">&gt;&gt;&gt; s = ['python', 'java', ['asp', 'php'], 'scheme']</span><br><span class="line">&gt;&gt;&gt; s[<span class="string">2</span>][<span class="symbol">1</span>]</span><br><span class="line">php</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>空列表</p>
                  <figure class="highlight ruby">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">&gt;&gt;</span>&gt; L = []</span><br><span class="line"><span class="meta">&gt;&gt;</span>&gt; len(L)</span><br><span class="line"><span class="number">0</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h2 id="5-元组-tuple"><a href="#5-元组-tuple" class="headerlink" title="5.元组 tuple"></a>5.元组 tuple</h2>
                  <p>不可变有序的数组 定义元组</p>
                  <figure class="highlight ruby">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">&gt;&gt;</span>&gt; classmates = (<span class="string">'Michael'</span>, <span class="string">'Bob'</span>, <span class="string">'Tracy'</span>)</span><br><span class="line"><span class="meta">&gt;&gt;</span>&gt; classmates</span><br><span class="line">(<span class="string">'Michael'</span>, <span class="string">'Bob'</span>, <span class="string">'Tracy'</span>)</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>空的元组</p>
                  <figure class="highlight ruby">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">&gt;&gt;</span>&gt; classmates = ()</span><br><span class="line"><span class="meta">&gt;&gt;</span>&gt; classmates </span><br><span class="line">()</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>一个元素的元组</p>
                  <figure class="highlight ruby">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">&gt;&gt;</span>&gt; t = (<span class="number">1</span>,)</span><br><span class="line"><span class="meta">&gt;&gt;</span>&gt; t</span><br><span class="line">(<span class="number">1</span>,)</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>注意不能用 t = (1) 来定义， 因为它定义的不是tuple，是 1 这个数，这是因为括号既可以表示tuple，又可以表示数学公式中的小括号，这就产生了歧义，因此，Python规定，这种情况下，按小括号进行计算，计算结果自然是1。 表面上可变的tuple</p>
                  <figure class="highlight markdown">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">&gt;&gt;&gt; t = ('a', 'b', ['A', 'B'])</span><br><span class="line">&gt;&gt;&gt; t[<span class="string">2</span>][<span class="symbol">0</span>] = 'X'</span><br><span class="line">&gt;&gt;&gt; t[<span class="string">2</span>][<span class="symbol">1</span>] = 'Y'</span><br><span class="line">&gt;&gt;&gt; t</span><br><span class="line">('a', 'b', ['X', 'Y'])</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>表面上看，tuple的元素确实变了，但其实变的不是tuple的元素，而是list的元素。tuple一开始指向的list并没有改成别的list，所以，tuple所谓的“不变”是说，tuple的每个元素，指向永远不变。即指向 ‘a’，就不能改成指向 ‘b’ ，指向一个list，就不能改成指向其他对象，但指向的这个list本身是可变的！</p>
                  <h2 id="6-字典-dict"><a href="#6-字典-dict" class="headerlink" title="6.字典 dict"></a>6.字典 dict</h2>
                  <p>字典 dict 即键值对组，dict的key必须是不可变对象。</p>
                  <figure class="highlight ruby">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">&gt;&gt;</span>&gt; d = &#123;<span class="string">'Michael'</span>: <span class="number">95</span>, <span class="string">'Bob'</span>: <span class="number">75</span>, <span class="string">'Tracy'</span>: <span class="number">85</span>&#125;</span><br><span class="line"><span class="meta">&gt;&gt;</span>&gt; d[<span class="string">'Michael'</span>]</span><br><span class="line"><span class="number">95</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>把数据放入dict的方法，除了初始化时指定外，还可以通过key放入，在这之前，d 必须被声明，否则会报错</p>
                  <figure class="highlight ruby">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">&gt;&gt;</span>&gt; d[<span class="string">'Adam'</span>] = <span class="number">67</span></span><br><span class="line"><span class="meta">&gt;&gt;</span>&gt; d[<span class="string">'Adam'</span>]</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>判断key是否在字典中 1. in 判断</p>
                  <figure class="highlight ruby">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">&gt;&gt;</span>&gt; <span class="string">'Thomas'</span> in d</span><br><span class="line">False</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>2. 通过dict提供的get方法，如果key不存在，可以返回None，或者自己指定的value</p>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">&gt;&gt;&gt; <span class="builtin-name">print</span> d.<span class="builtin-name">get</span>(<span class="string">'Thomas'</span>)</span><br><span class="line">None</span><br><span class="line">&gt;&gt;&gt; <span class="builtin-name">print</span> d.<span class="builtin-name">get</span>(<span class="string">'Thomas'</span>, -1)</span><br><span class="line">-1</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>要删除一个key，用 pop(key) 方法，对应的value也会从dict中删除</p>
                  <figure class="highlight ruby">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">&gt;&gt;</span>&gt; d.pop(<span class="string">'Bob'</span>)</span><br><span class="line"><span class="number">75</span></span><br><span class="line"><span class="meta">&gt;&gt;</span>&gt; d</span><br><span class="line">&#123;<span class="string">'Michael'</span>: <span class="number">95</span>, <span class="string">'Tracy'</span>: <span class="number">85</span>&#125;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h2 id="7-集合-set"><a href="#7-集合-set" class="headerlink" title="7.集合 set"></a>7.集合 set</h2>
                  <p>set和dict类似，也是一组key的集合，但不存储value。由于key不能重复，所以，在set中，没有重复的key。 要创建一个set，需要提供一个list作为输入集合：</p>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">&gt;&gt;&gt; s = <span class="keyword">set</span>([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>])</span><br><span class="line">&gt;&gt;&gt; s</span><br><span class="line"><span class="keyword">set</span>([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>])</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>重复元素在set中自动被过滤：</p>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">&gt;&gt;&gt; s = <span class="keyword">set</span>([<span class="number">1</span>, <span class="number">1</span>, <span class="number">2</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">3</span>])</span><br><span class="line">&gt;&gt;&gt; s</span><br><span class="line"><span class="keyword">set</span>([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>])</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>通过 add(key) 方法可以添加元素到set中，可以重复添加，但不会有效果：</p>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">&gt;&gt;&gt; s.add(<span class="number">4</span>)</span><br><span class="line">&gt;&gt;&gt; s</span><br><span class="line"><span class="keyword">set</span>([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>])</span><br><span class="line">&gt;&gt;&gt; s.add(<span class="number">4</span>)</span><br><span class="line">&gt;&gt;&gt; s</span><br><span class="line"><span class="keyword">set</span>([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>])</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>通过 remove(key) 方法可以删除元素：</p>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">&gt;&gt;&gt; s.remove(<span class="number">4</span>)</span><br><span class="line">&gt;&gt;&gt; s</span><br><span class="line"><span class="keyword">set</span>([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>])</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>判断元素是否在set中</p>
                  <figure class="highlight yaml">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="string">&gt;&gt;&gt;</span> <span class="number">5</span> <span class="string">in</span> <span class="string">s</span> </span><br><span class="line"><span class="literal">True</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>set可以看成数学意义上的无序和无重复元素的集合，因此，两个set可以做数学意义上的交集、并集等操作：</p>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">&gt;&gt;&gt; s1 = <span class="keyword">set</span>([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>])</span><br><span class="line">&gt;&gt;&gt; s2 = <span class="keyword">set</span>([<span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>])</span><br><span class="line">&gt;&gt;&gt; s1 &amp; s2</span><br><span class="line"><span class="keyword">set</span>([<span class="number">2</span>, <span class="number">3</span>])</span><br><span class="line">&gt;&gt;&gt; s1 | s2</span><br><span class="line"><span class="keyword">set</span>([<span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>])</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2015-01-30 18:52:35" itemprop="dateCreated datePublished" datetime="2015-01-30T18:52:35+08:00">2015-01-30</time>
                </span>
                <span id="/792.html" class="post-meta-item leancloud_visitors" data-flag-title="Python学习基础知识概要" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>4.1k</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>4 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/782.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> HTML <i class="label-arrow"></i>
                  </a>
                  <a href="/782.html" class="post-title-link" itemprop="url">利用响应式布局搭建自己的个人简介网站（CV）</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>之前一直想搭建一个个人CV，用来展示自己的详情，技能树，项目经历等等。从网上看了许多模板，发现扁平化设计的单页模板非常适合，不过下载了几个之后，直接拿来修改用了感觉没有什么可以学到的东西，现在扁平化趋势这么流行，加上网页的响应式布局也越来越火，何不自己尝试一把？ 2015年1月23日，寒假正式结束了，处理完一些小事，就开始着手搭建个人CV了。四五天的时间，从学习相关BootStrap知识，响应式布局的相关了解，美工切图，代码实际编写，差不多搭建完毕，不过还有好多地方需要完善，欢迎访问 <a href="http://cv.cuiqingcai.com" target="_blank" rel="noopener">我的个人简介</a> 搭建此网页需要具备的相关知识有：</p>
                  <ul>
                    <li>Media Query相关了解</li>
                    <li>BootStrap框架布局的了解</li>
                    <li>jQuery相关语法的了解</li>
                    <li>font owesome图标框架的了解</li>
                    <li>Canvas绘图的了解</li>
                  </ul>
                  <p>1.Media Query 关于响应式布局，首先要了解的是 Media Query的相关知识，翻译过来就是媒体查询的意思，它可以使不同大小的网页适应几套不同的CSS布局。比如笔记本电脑，屏幕宽度大都在1300px以上，可以匹配最高分辩率对应的CSS布局；又如平板电脑，屏幕宽度750px左右，可以适配中等分辨率对应的CSS布局；至于手机，则适配最小分辨率的CSS布局。这样，一次编写网站，多种终端可以看到不同的效果，不过代码只有一份，这就是响应式布局。 传送门：<a href="http://www.w3cplus.com/content/css3-media-queries" target="_blank" rel="noopener">Media Query 简介</a> 2.BootStrap BootStrap是一款非常有名的前端框架，只需要写非常少的代码即可，如果你只会了Media Query，自己编写完全没有问题，不过代码的复杂度会大大增加，而且不一定可以适配多种浏览器，可能你在Chrome里面是正常的，跑到IE你会惊呆的！所以，BootStrap是你的最好选择，简化的代码加多种浏览器适配，还有栅格化布局是相当给力，值得一试。 3.jQuery 毕竟是自己完全编写整个网页，有些适配或者动画处理还是需要JS来实现，如果涉及到CSS样式的应用，jQuery是你最好的选择。 强大的JS框架，各种动画效果均可以通过jQuery实现。当然前期的搭建不需要过多的jQuery特效，如果你想让自己的个人CV变得更炫，推荐一用。 4.Font Awesome 如果你需要用到各种图标，那么你还在苦苦地用PS抠图绘制吗？你错了，利用Font Awesome 图标框架，只需要添加一句代码，即可轻松插入你想要的图标，比如新浪微博，人人网等等，素材应有尽有。 传送门：<a href="http://fontawesome.dashgame.com/" target="_blank" rel="noopener">Font Awesome 框架</a> 5.Canvas绘图 如果你想要自己的网站更炫酷，有各种动画效果。例如制作一个圆形的进度条，那么Canvas是不二选择。不过稍微有些复杂，我在创建圆形进度条的时候就偷懒直接抠了四张进度条图，是不是很机智？哈哈。不过，如果你想修改了，不能继续抠图吧？那就用Canvas绘图吧！ 以上算是个人心得，也算是一个个人日记，也希望能给读者带来一些帮助！</p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2015-01-30 11:07:54" itemprop="dateCreated datePublished" datetime="2015-01-30T11:07:54+08:00">2015-01-30</time>
                </span>
                <span id="/782.html" class="post-meta-item leancloud_visitors" data-flag-title="利用响应式布局搭建自己的个人简介网站（CV）" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>1.2k</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>1 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/789.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> 个人日记 <i class="label-arrow"></i>
                  </a>
                  <a href="/789.html" class="post-title-link" itemprop="url">放下 · 坦然</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>曾经以为过不去的，终究会过去。痛苦有时候是一种提升，否则，我们流的眼泪也就毫无意义。</p>
                  <p>感谢她曾经给我带来的幸福甜蜜，有些事也不必将就，不必强求。</p>
                  <p>继续前行吧，成为更好的自己，也祝她能够幸福。</p>
                  <p>放下 · 坦然</p>
                  <p>曾经的她</p>
                  <p><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2015/01/cBfQq.jpg" alt="cBfQq"></p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2015-01-26 23:54:53" itemprop="dateCreated datePublished" datetime="2015-01-26T23:54:53+08:00">2015-01-26</time>
                </span>
                <span id="/789.html" class="post-meta-item leancloud_visitors" data-flag-title="放下 · 坦然" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>102</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>1 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/548.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> HTML <i class="label-arrow"></i>
                  </a>
                  <a href="/548.html" class="post-title-link" itemprop="url">HTML5视频教程</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <h2 id="关于HTML5"><a href="#关于HTML5" class="headerlink" title="关于HTML5"></a>关于HTML5</h2>
                  <p>万维网的核心语言、标准通用标记语言下的一个应用超文本标记语言（HTML）的第五次重大修改。 2014年10月29日，万维网联盟宣布，经过几乎8年的艰辛努力，该标准规范终于最终制定完成。 在此提供HTML5视频教程。 视频来源：兄弟连教育 感谢 @<a href="http://weibo.com/lampbrother" target="_blank" rel="noopener">兄弟连教育</a></p>
                  <h2 id="关于兄弟连"><a href="#关于兄弟连" class="headerlink" title="关于兄弟连"></a>关于兄弟连</h2>
                  <p>兄弟连成立于2006年，专注于IT技术培训，是国内最早及最大的PHP/LAMP技术专业培训学校。 兄弟连现已开设PHP/Java/Android/IOS/手游/云计算/UI等多学科，累计培养逾万名学员，2014年学员就业平均起薪高达5500元+。 兄弟连已是第9个年头，这条路虽历尽艰辛，但我们痴心不改。我们就是想让学员们知道：不是所有的培训机构都是骗人的！ 在兄弟连，你可以找到自我、重拾自信；在兄弟连，你会每天渴求成长，学到深夜； 在兄弟连，你把学习当成一种习惯；在兄弟连，你有更多的兄弟姐妹； 在兄弟连，有陪你一起熬夜的老师；在兄弟连，你会被“狠狠”的爱着…… 兄弟连已在北京、上海和广州设立校区，今后几年内将会陆续在成都、西安等地建设校区，每年有数十万名学员受益于兄弟连教育的职业培训、教学视频、网络公开课。</p>
                  <blockquote>
                    <p>兄弟连</p>
                    <p>“我们不仅仅是老师，我们是学员的梦想守护者与职场引路人。” 我们不敢妄言改变中国教育，只是低下头认认真真做教育。兄弟连没有做什么惊天动地的大事，我们就是把别人不愿做的脏活累活做到极致，做教育就是需要这种工匠精神。 在中国，选择职业培训的学生，一定是对自己未来有憧憬、想改变命运的有志青年。主观上有学习的欲望，客观上自控能力差，需要外力协助其改变。 教学靠谱/变态严管/职业素养课我们的核心竞争力。 培训结束会有脱胎换骨的感觉，怕死别来兄弟连！</p>
                  </blockquote>
                  <h2 id="视频下载"><a href="#视频下载" class="headerlink" title="视频下载"></a>视频下载</h2>
                  <p><a href="http://pan.baidu.com/s/1CoR5k" target="_blank" rel="noopener">视频下载</a></p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-12-22 14:20:31" itemprop="dateCreated datePublished" datetime="2014-12-22T14:20:31+08:00">2014-12-22</time>
                </span>
                <span id="/548.html" class="post-meta-item leancloud_visitors" data-flag-title="HTML5视频教程" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>715</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>1 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/545.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> PHP <i class="label-arrow"></i>
                  </a>
                  <a href="/545.html" class="post-title-link" itemprop="url">PHP基础视频学习教程</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <h2 id="关于PHP"><a href="#关于PHP" class="headerlink" title="关于PHP"></a>关于PHP</h2>
                  <p>PHP（外文名: Hypertext Preprocessor，中文名：“超文本预处理器”）是一种通用开源脚本语言。语法吸收了C语言、Java和Perl的特点，利于学习，使用广泛，主要适用于Web开发领域。PHP 独特的语法混合了C、Java、Perl以及PHP自创的语法。它可以比CGI或者Perl更快速地执行动态网页。用PHP做出的动态页面与其他的编程语言相比，PHP是将程序嵌入到HTML（标准通用标记语言下的一个应用）文档中去执行，执行效率比完全生成HTML标记的CGI要高许多；PHP还可以执行编译后代码，编译可以达到加密和优化代码运行，使代码运行更快。 在此提供PHP视频教程，视频来源：兄弟连教育</p>
                  <h2 id="关于兄弟连"><a href="#关于兄弟连" class="headerlink" title="关于兄弟连"></a>关于兄弟连</h2>
                  <p>兄弟连成立于2006年，专注于IT技术培训，是国内最早及最大的PHP/LAMP技术专业培训学校。 兄弟连现已开设PHP/Java/Android/IOS/手游/云计算/UI等多学科，累计培养逾万名学员，2014年学员就业平均起薪高达5500元+。 兄弟连已是第9个年头，这条路虽历尽艰辛，但我们痴心不改。我们就是想让学员们知道：不是所有的培训机构都是骗人的！ 在兄弟连，你可以找到自我、重拾自信；在兄弟连，你会每天渴求成长，学到深夜； 在兄弟连，你把学习当成一种习惯；在兄弟连，你有更多的兄弟姐妹； 在兄弟连，有陪你一起熬夜的老师；在兄弟连，你会被“狠狠”的爱着…… 兄弟连已在北京、上海和广州设立校区，今后几年内将会陆续在成都、西安等地建设校区，每年有数十万名学员受益于兄弟连教育的职业培训、教学视频、网络公开课。</p>
                  <blockquote>
                    <p>兄弟连</p>
                    <p>“我们不仅仅是老师，我们是学员的梦想守护者与职场引路人。” 我们不敢妄言改变中国教育，只是低下头认认真真做教育。兄弟连没有做什么惊天动地的大事，我们就是把别人不愿做的脏活累活做到极致，做教育就是需要这种工匠精神。 在中国，选择职业培训的学生，一定是对自己未来有憧憬、想改变命运的有志青年。主观上有学习的欲望，客观上自控能力差，需要外力协助其改变。 教学靠谱/变态严管/职业素养课我们的核心竞争力。 培训结束会有脱胎换骨的感觉，怕死别来兄弟连！</p>
                  </blockquote>
                  <p>感谢 <a href="http://weibo.com/lampbrother" target="_blank" rel="noopener">@兄弟连教育</a> <a href="http://pan.baidu.com/s/1hqmXL68" target="_blank" rel="noopener">视频下载</a></p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-12-22 13:33:09" itemprop="dateCreated datePublished" datetime="2014-12-22T13:33:09+08:00">2014-12-22</time>
                </span>
                <span id="/545.html" class="post-meta-item leancloud_visitors" data-flag-title="PHP基础视频学习教程" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>895</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>1 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/539.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> Java <i class="label-arrow"></i>
                  </a>
                  <a href="/539.html" class="post-title-link" itemprop="url">Java SE 视频学习教程</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>Java是由<a href="http://baike.baidu.com/view/1061350.htm" target="_blank" rel="noopener">Sun Microsystems</a>公司推出的Java面向对象程序设计语言（以下简称Java语言）和Java平台的总称。 <a href="http://baike.baidu.com/subview/29/12654100.htm" target="_blank" rel="noopener">Java</a>分为三个体系Java SE（<a href="http://baike.baidu.com/view/160728.htm" target="_blank" rel="noopener">J2SE</a>，Java2 Platform Standard Edition，标准版），JavaEE（<a href="http://baike.baidu.com/view/1507.htm" target="_blank" rel="noopener">J2EE</a>，Java 2 Platform, Enterprise Edition，企业版），Java ME（<a href="http://baike.baidu.com/view/7125.htm" target="_blank" rel="noopener">J2ME</a>，Java 2 Platform Micro Edition，微型版）。 在此提供Java SE的视频教程，感谢@<a href="http://weibo.com/lampbrother" target="_blank" rel="noopener">兄弟连教育</a> 视频来源：兄弟连教育 <a href="http://pan.baidu.com/s/1dDEiswT" target="_blank" rel="noopener">视频下载</a></p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-12-22 13:22:41" itemprop="dateCreated datePublished" datetime="2014-12-22T13:22:41+08:00">2014-12-22</time>
                </span>
                <span id="/539.html" class="post-meta-item leancloud_visitors" data-flag-title="Java SE 视频学习教程" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>249</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>1 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/536.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> PHP <i class="label-arrow"></i>
                  </a>
                  <a href="/536.html" class="post-title-link" itemprop="url">CodeIgniter视频学习教程</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <h2 id="关于PHP"><a href="#关于PHP" class="headerlink" title="关于PHP"></a>关于PHP</h2>
                  <p>PHP（外文名: Hypertext Preprocessor，中文名：“超文本预处理器”）是一种通用开源脚本语言。语法吸收了C语言、Java和Perl的特点，利于学习，使用广泛，主要适用于Web开发领域。PHP 独特的语法混合了C、Java、Perl以及PHP自创的语法。它可以比CGI或者Perl更快速地执行动态网页。用PHP做出的动态页面与其他的编程语言相比，PHP是将程序嵌入到HTML（标准通用标记语言下的一个应用）文档中去执行，执行效率比完全生成HTML标记的CGI要高许多；PHP还可以执行编译后代码，编译可以达到加密和优化代码运行，使代码运行更快。 在此提供PHP视频教程，视频来源：兄弟连教育</p>
                  <h2 id="关于CI"><a href="#关于CI" class="headerlink" title="关于CI"></a>关于CI</h2>
                  <p>如果你已经掌握了一点PHP知识，如果…</p>
                  <ol>
                    <li>你想要一个小巧的框架。</li>
                    <li>你需要出色的性能。</li>
                    <li>你需要广泛兼容标准主机上的各种 PHP 版本和配置。</li>
                    <li>你想要一个几乎只需 0 配置的框架。</li>
                    <li>你想要一个不需使用命令行的框架。</li>
                    <li>你想要一个不需坚守限制性编码规则的框架。</li>
                    <li>你对 PEAR 这种大规模集成类库不感兴趣。</li>
                    <li>你不希望被迫学习一门模板语言(虽然可以选择你喜欢的模板解析器)。</li>
                    <li>你不喜欢复杂，热爱简单。</li>
                    <li>你需要清晰、完善的文档。</li>
                  </ol>
                  <p>那么CodeIgniter就是你的最好选择，在此提供一个学习视频，供大家学习</p>
                  <h2 id="关于兄弟连"><a href="#关于兄弟连" class="headerlink" title="关于兄弟连"></a>关于兄弟连</h2>
                  <p>兄弟连成立于2006年，专注于IT技术培训，是国内最早及最大的PHP/LAMP技术专业培训学校。 兄弟连现已开设PHP/Java/Android/IOS/手游/云计算/UI等多学科，累计培养逾万名学员，2014年学员就业平均起薪高达5500元+。 兄弟连已是第9个年头，这条路虽历尽艰辛，但我们痴心不改。我们就是想让学员们知道：不是所有的培训机构都是骗人的！ 在兄弟连，你可以找到自我、重拾自信；在兄弟连，你会每天渴求成长，学到深夜； 在兄弟连，你把学习当成一种习惯；在兄弟连，你有更多的兄弟姐妹； 在兄弟连，有陪你一起熬夜的老师；在兄弟连，你会被“狠狠”的爱着…… 兄弟连已在北京、上海和广州设立校区，今后几年内将会陆续在成都、西安等地建设校区，每年有数十万名学员受益于兄弟连教育的职业培训、教学视频、网络公开课。</p>
                  <blockquote>
                    <p>兄弟连</p>
                    <p>“我们不仅仅是老师，我们是学员的梦想守护者与职场引路人。” 我们不敢妄言改变中国教育，只是低下头认认真真做教育。兄弟连没有做什么惊天动地的大事，我们就是把别人不愿做的脏活累活做到极致，做教育就是需要这种工匠精神。 在中国，选择职业培训的学生，一定是对自己未来有憧憬、想改变命运的有志青年。主观上有学习的欲望，客观上自控能力差，需要外力协助其改变。 教学靠谱/变态严管/职业素养课我们的核心竞争力。 培训结束会有脱胎换骨的感觉，怕死别来兄弟连！</p>
                  </blockquote>
                  <p> 感谢 <a href="http://weibo.com/lampbrother" target="_blank" rel="noopener">@兄弟连教育</a> <a href="http://pan.baidu.com/s/1c0tl9M4" target="_blank" rel="noopener">视频下载</a></p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-12-22 13:14:50" itemprop="dateCreated datePublished" datetime="2014-12-22T13:14:50+08:00">2014-12-22</time>
                </span>
                <span id="/536.html" class="post-meta-item leancloud_visitors" data-flag-title="CodeIgniter视频学习教程" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>1.1k</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>1 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/512.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> Linux <i class="label-arrow"></i>
                  </a>
                  <a href="/512.html" class="post-title-link" itemprop="url">在Ubuntu下搭建VPN服务器的方法</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>VPN是什么？中文翻译叫做：虚拟专用网络。功能是，在公用网络上建立专用网络，进行加密通讯。 适用的场合： 1.你的公司网络在一个局域网，不能外部访问。有一天你外出度假了，想访问一下公司的内部网络，外网是不能直接访问的。如果公司的网络有一台主机设置了VPN，你就可以通过连上这台VPN主机，来访问公司内部网络啦。 2.如果你的主机是在国外，你可以在这台主机上配置VPN，然后你的电脑连上VPN之后就可以翻墙啦。 3.某台服务器（如游戏服务器）限制了一些IP连接到它上面，这时你配置VPN，连上VPN之后，就可以继续访问那台服务器咯。 4.etc… 我们以Ubuntu为例，说一下怎样配置VPN服务器。 1、用root账户登陆服务器 2、安装PPTPD</p>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">apt-<span class="builtin-name">get</span> install pptpd</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>3、编辑pptpd.conf文件</p>
                  <figure class="highlight vim">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="keyword">vi</span> /etc/pptpd.<span class="keyword">conf</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>取消注释下面内容</p>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">localip <span class="number">192.168</span><span class="number">.0</span><span class="number">.1</span></span><br><span class="line">remoteip <span class="number">192.168</span><span class="number">.0</span><span class="number">.234</span><span class="number">-238</span>,<span class="number">192.168</span><span class="number">.0</span><span class="number">.245</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>这几句的意思是：当外部计算机通过pptp联接到vpn后所能拿到的ip地址范围和服务器的ip地址设置。 4、添加用于登陆的账户</p>
                  <figure class="highlight awk">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">vi <span class="regexp">/etc/</span>ppp<span class="regexp">/chap-secrets</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>格式如下：</p>
                  <figure class="highlight armasm">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"># client server secret <span class="built_in">IP</span> <span class="keyword">addresses</span></span><br><span class="line"><span class="keyword">cqc </span>pptpd <span class="number">123456</span> *</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>从左到右依次是用户名，自己指定。服务器，填写pptpd，密码，自己指定。IP，填*即可。中间用空格分别隔开。 5、设置DNS解析，编辑pptpd-options文件</p>
                  <figure class="highlight vim">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="keyword">vi</span> /etc/ppp/pptpd-<span class="keyword">options</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>找到ms-dns，取消掉注释，并修改DNS地址，这里我推荐大家用 Google DNS 8.8.8.8 和 8.8.4.4 更改为如下内容</p>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">ms-dns <span class="number">8.8</span><span class="number">.8</span><span class="number">.8</span></span><br><span class="line">ms-dns <span class="number">8.8</span><span class="number">.4</span><span class="number">.4</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>6、开启转发</p>
                  <figure class="highlight vim">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="keyword">vi</span> /etc/sysctl.<span class="keyword">conf</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>取消注释以下内容</p>
                  <figure class="highlight ini">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attr">net.ipv4.ip_forward</span>=<span class="number">1</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>这句话意思是：打开内核IP转发 更新一下配置</p>
                  <figure class="highlight ebnf">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">sudo sysctl -p</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>7、安装iptables并设置</p>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">apt-<span class="builtin-name">get</span> install iptables</span><br><span class="line">sudo iptables -t<span class="built_in"> nat </span>-A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>后面这句话作用是：立刻让LINUX支持NAT(platinum) 8、重新启动服务</p>
                  <figure class="highlight awk">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="regexp">/etc/i</span>nit.d<span class="regexp">/pptpd restart</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>9、大功告成，VPN服务器就这么配置好啦。 接下来，利用IP地址，刚才设置的VPN账号和密码，就可以连你的VPN啦。 如果有问题，欢迎与我交流~</p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-12-03 22:26:49" itemprop="dateCreated datePublished" datetime="2014-12-03T22:26:49+08:00">2014-12-03</time>
                </span>
                <span id="/512.html" class="post-meta-item leancloud_visitors" data-flag-title="在Ubuntu下搭建VPN服务器的方法" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>1.1k</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>1 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/495.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> Other <i class="label-arrow"></i>
                  </a>
                  <a href="/495.html" class="post-title-link" itemprop="url">在GitHub多个账号上使用不同的SSH的配置方法</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>现在遇到这么一个情况，在我电脑上配置了一对SSH秘钥，其中公钥已经添加到了我的GitHub上面。 现在我又申请了一个账号，我同样想添加这个秘钥到这个账号上去，但是GitHub提示了一个错误，说这个公钥已经被使用，不能添加。 于是，我意识到了一个问题，同一个公钥是不能添加到不同的GitHub账号的。在我的GitHub上配置了，另一个就不能配置了。 所以，我需要重新生成一对SSH，过程如下： 在命令行中输入：</p>
                  <figure class="highlight 1c">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">ssh-keygen -t rsa -C '<span class="number">1016903103</span>@qq.com'</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <figure class="highlight processing">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">Generating <span class="keyword">public</span>/<span class="keyword">private</span> rsa <span class="built_in">key</span> pair.</span><br><span class="line">Enter file in which to <span class="built_in">save</span> the <span class="built_in">key</span> (~/.ssh/id_rsa): ~/.ssh/id_rsa2 #这里输入一个新的ssh <span class="built_in">key</span>文件名</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>在这里我们就输入 ~/.ssh/id_rsa2 了，注意此处一定要加上路径名，要不然生成的秘钥不会保存到 .ssh文件夹中。 后面会让你提示输入密码，直接回车两次就好了，如果你非要输入密码也没事。 接下来就会提示秘钥生成成功，会打印出你生成的秘钥。 ~/.ssh/id_rsa2为新SSH Keys文件名，根据实际情况修改，保证每次不一样即可。 打开新生成的~/.ssh/id_rsa2.pub文件，将里面的内容添加到GitHub后台，在这里我就添加到我另一个GitHub账号里了。 接下来你再Push尝试一下，发现会提交失败，提示如下的内容。</p>
                  <figure class="highlight livecodeserver">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">Please make sure you have <span class="keyword">the</span> correct access rights </span><br><span class="line"><span class="keyword">and</span> <span class="keyword">the</span> repository exists.</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>这是因为它默认识别了你第一个私钥，也就是id_rsa 为了让它识别你新生成的私钥，你需要在.ssh目录，注意一定要是.ssh目录，和你的秘钥放在一块。要不然不能识别，新建一个config文件，不要后缀，文件名即为config 输入如下内容：</p>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">Host git@github2.com   #此处可以随意指定</span><br><span class="line">HostName github.com</span><br><span class="line">User git</span><br><span class="line">Port 22</span><br><span class="line">IdentityFile ~/.ssh/id_rsa2   #你新生成的SSH名字</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>Git的时候不是有一个SSH地址吗？比如我原先的是</p>
                  <figure class="highlight groovy">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git<span class="meta">@github</span>.<span class="string">com:</span>cqcre/shiyida.git</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>现在我们就要把它改成</p>
                  <figure class="highlight groovy">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git<span class="meta">@github</span>2.<span class="string">com:</span>cqcre/shiyida.git</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>其中：前面的内容就是你填写的Host内容。 你可以随意更改，这里我为了保持风格统一，就把Host设置为了 git@github2.com 如果你的Host设置为xxx，那么我的SSH地址就要改为 xxx:cqcre/shiyida.git，你的地址相对应地更改。 现在尝试一下，就可以Push了，如果还不能，请重新打开Git Bash，需要关闭后再次开启一下Git才能生效的。 如果有问题，与我联系~ 邮箱 1016903103@qq.com QQ 1016903103</p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-12-01 14:08:41" itemprop="dateCreated datePublished" datetime="2014-12-01T14:08:41+08:00">2014-12-01</time>
                </span>
                <span id="/495.html" class="post-meta-item leancloud_visitors" data-flag-title="在GitHub多个账号上使用不同的SSH的配置方法" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>1.2k</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>1 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/444.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> PHP <i class="label-arrow"></i>
                  </a>
                  <a href="/444.html" class="post-title-link" itemprop="url">PHP实现飞信接口来通过网页免费发短信</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>首先感谢郝同学告诉我这么一个神奇的接口 可以输入你的手机号、密码、对方手机号、发送内容直接给对方发短信。 源作者博客地址为：<a href="http://blog.quanhz.com/" target="_blank" rel="noopener">http://blog.quanhz.com/</a> 郝同学的博客地址：<a href="http://www.findspace.name" target="_blank" rel="noopener">http://www.findspace.name</a> 我们先来演示下这个接口的功能： 测试地址：<a href="http://res.cuiqingcai.com/fetion/" target="_blank" rel="noopener">res.cuiqingcai.com/fetion</a> 进入之后会让您选择两种发送方式，一种是GET，一种是POST 两种方式什么区别？最重要的区别是GET方式是直接以链接形式访问，链接中包含了所有的参数，当然如果包含了密码的话是一种不安全的选择，不过你可以直观地看到自己提交了什么内容。POST则不会在网址上显示所有的参数，不过如果你想直接查看提交了什么就不太方便了，大家可以酌情选择。 <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141123225356.jpg" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141123225356.jpg" alt="QQ截图20141123225356"></a> 或者直接通过以下接口来访问： 1. GET方式：<a href="http://res.cuiqingcai.com/fetion/get.php" target="_blank" rel="noopener">http://res.cuiqingcai.com/fetion/get.php</a> 2.POST方式：<a href="http://res.cuiqingcai.com/fetion/post.php" target="_blank" rel="noopener">http://res.cuiqingcai.com/fetion/post.php</a> 二者界面相同，功能稍有不同而已。 <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141123230147.jpg" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141123230147.jpg" alt="QQ截图20141123230147"></a> 点击发送之后，便可以向你的飞信好友发送短信了。是不是很神奇，如果你输入的号码不合法，会自动通过JS判定，如果不合法，不会提交。 那么接口是怎样调用的呢？ GET接口是这样的：通过访问一个URL来进行发送短信。参数如下： 1.你的手机号 2.飞信密码 3.对方的手机号 4.要发送的信息。 例如：<a href="http://res.cuiqingcai.com/fetion/php/gsend.php?user=18366119732&amp;key=abcd&amp;number=18366119732&amp;text=hello" target="_blank" rel="noopener">http://res.cuiqingcai.com/fetion/php/gsend.php?user=18366119732&amp;key=abcd&amp;number=18366119732&amp;text=hello</a> 加入这四个参数之后，你便可以通过访问这个网址来向好友发送短信。那么18366119732 就能收到hello的信息了,并通过查看返回值来判断发送状况。 P.S.输入你的飞信密码后我不会盗取你的密码的，源码地址在下面，大家可以自行查看。相信我的人品，我不会偷偷存到数据库的… 如果担心，请自行下载源码，并部署到自己的服务器上。 接口为PHP版本，我对其源码进行了重构，增加了返回登录信息的功能。并对其接口进行了重写，增加了是否登录成功，是否信息为空，是否信息过长，是否是给自己发短信，是否是给别人发短信的判定，并返回相应的结果。 返回结果判定如下：</p>
                  <figure class="highlight php">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="keyword">if</span>(strpos($result,<span class="string">'请输入密码'</span>))&#123;</span><br><span class="line"> <span class="comment">//登录失败</span></span><br><span class="line"> <span class="keyword">echo</span> <span class="string">"D"</span>;</span><br><span class="line">&#125;<span class="keyword">else</span> <span class="keyword">if</span>(strpos($result,<span class="string">'NoMessage'</span>))&#123;</span><br><span class="line"> <span class="comment">//发送的消息为空</span></span><br><span class="line"> <span class="keyword">echo</span> <span class="string">"K"</span>;</span><br><span class="line">&#125;<span class="keyword">else</span> <span class="keyword">if</span>(strpos($result,<span class="string">'限制在500字'</span>))&#123;</span><br><span class="line"> <span class="comment">//发送内容超长</span></span><br><span class="line"> <span class="keyword">echo</span> <span class="string">"L"</span>;</span><br><span class="line">&#125;<span class="keyword">else</span> <span class="keyword">if</span>(strpos($result, <span class="string">'短信发送成功!'</span>)) &#123;</span><br><span class="line"> <span class="comment">//给自己发送成功</span></span><br><span class="line"> <span class="keyword">echo</span> <span class="string">"M"</span>;</span><br><span class="line">&#125;<span class="keyword">else</span> <span class="keyword">if</span>(strpos($result,<span class="string">'发送消息成功'</span>))&#123;</span><br><span class="line"> <span class="comment">//给别人发送成功</span></span><br><span class="line"> <span class="keyword">echo</span> <span class="string">"O"</span>;</span><br><span class="line">&#125;<span class="keyword">else</span> &#123;</span><br><span class="line"> <span class="comment">//不是好友，发送失败</span></span><br><span class="line"> <span class="keyword">echo</span> <span class="string">"H"</span>;</span><br><span class="line">&#125;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>1.登录失败:D 2.发送消息为空:K 3.发送内容超长:L 4.给自己发送成功:M 5.给别人发送成功:O 6.不是好友，发送失败:H 返回结果大家可以更改echo的内容自己定制。 在下面附上接口及测试的源代码： <a href="https://github.com/cqcre/fetion" target="_blank" rel="noopener">https://github.com/cqcre/fetion</a> 另附：JS和PHP用正则表达式判定手机号是否合法的方法，新增加了最新4G手机号的判定。 JS：</p>
                  <figure class="highlight lsl">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">var number = $(<span class="string">"#number"</span>).val();</span><br><span class="line"> if((number.length != <span class="number">11</span>) || (!number.match(/^(<span class="number">13</span>[<span class="number">0</span><span class="number">-9</span>]|<span class="number">14</span>[<span class="number">5</span>|<span class="number">7</span>]|<span class="number">15</span>[<span class="number">0</span>|<span class="number">1</span>|<span class="number">2</span>|<span class="number">3</span>|<span class="number">5</span>|<span class="number">6</span>|<span class="number">7</span>|<span class="number">8</span>|<span class="number">9</span>]|<span class="number">17</span>[<span class="number">6</span>|<span class="number">7</span>|<span class="number">8</span>]|<span class="number">18</span>[<span class="number">0</span><span class="number">-9</span>])\d&#123;<span class="number">8</span>&#125;$/)))&#123;</span><br><span class="line">    alert(<span class="string">"号码不合法"</span>);</span><br><span class="line"> &#125;else&#123;</span><br><span class="line">    alert(<span class="string">"号码合法"</span>);</span><br><span class="line">&#125;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>PHP:</p>
                  <figure class="highlight tex">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">if((strlen(<span class="formula">$phone) != 11) || !(preg_match("/13[0123456789]&#123;1&#125;<span class="tag">\<span class="name">d</span><span class="string">&#123;8&#125;</span></span>|15[012356789]<span class="tag">\<span class="name">d</span><span class="string">&#123;8&#125;</span></span>|18[0123456789]<span class="tag">\<span class="name">d</span><span class="string">&#123;8&#125;</span></span>|17[678]<span class="tag">\<span class="name">d</span><span class="string">&#123;8&#125;</span></span>|14[57]<span class="tag">\<span class="name">d</span><span class="string">&#123;8&#125;</span></span>/",$</span>phone)))&#123;</span><br><span class="line">    echo "手机号不合法";</span><br><span class="line"> &#125;else&#123;</span><br><span class="line">    echo "手机号合法";</span><br><span class="line"> &#125;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-11-23 23:28:15" itemprop="dateCreated datePublished" datetime="2014-11-23T23:28:15+08:00">2014-11-23</time>
                </span>
                <span id="/444.html" class="post-meta-item leancloud_visitors" data-flag-title="PHP实现飞信接口来通过网页免费发短信" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>2k</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>2 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/436.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> Linux <i class="label-arrow"></i>
                  </a>
                  <a href="/436.html" class="post-title-link" itemprop="url">在Ubuntu下搭建FTP服务器的方法</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>作为一名学生，免不了同学之间传送资料和数据的问题。 由于整个学校相当于一个大型局域网，相互之间传送数据非常快，比如要共享个电影，传点资料什么的。 所以我们可以选择搭建一个FTP服务器来共享文件。 那么问题来了，有的同学会问，我们既然在一个局域网内，直接用QQ传也很快啊，干嘛要搭建FTP服务器？ 那么告诉大家，如果两人不能同时在线呢？离线文件？传离线文件不就不走局域网了吗？ 还有如果你想一个人给多个人同时发呢？一个一个发？网盘链接？算了吧，等到花儿都谢了都下不完… 所以，明智的选择，FTP服务器。 在学校拥有了一台服务器之后，我可以把自己的资料或者电影放到我的FTP服务器上，分享给同学一个链接，分分钟下载完，当然我们需要在一个局域网才能有那样的速度，这样的话，不用我去开个QQ传，也不用动什么网盘分享，简单粗暴。 接下来我就说一下怎样配置自己的FTP服务器。 我的系统为Ubuntu，所以我选择了利用vsftpd来配置自己的服务器。 配置这个，为了确保安全，你可以选择使用用户名和密码来登录，也可以直接匿名登录…随你怎么来。 为了方便，我直接设置了匿名登录，这样让别人分享给我东西时，也不需要告诉别人用户名密码，直接拖进去上传就行了，方便快捷，不过安全性嘛，你懂得~ 这里我只配置了匿名的方式，具体的用户名密码登录的方式，网上的教程也是一大堆。 废话说了一大通了，开始干！配置很简单 首先下载安装vsftpd</p>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">sudo apt-<span class="builtin-name">get</span> install vsftpd</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>然后修改/etc/vsftpd.conf文件 修改如下几行： #为注释的意思，最前面不加#就是取消掉它的注释，使之生效</p>
                  <figure class="highlight ini">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attr">anonymous_enable</span>=<span class="literal">YES</span>    <span class="comment">#设置匿名可登录</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <figure class="highlight ini">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attr">local_enable</span>=<span class="literal">YES</span>        <span class="comment">#本地用户允许登录</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <figure class="highlight ini">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attr">write_enable</span>=<span class="literal">YES</span>        <span class="comment">#用户是否有写的权限</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <figure class="highlight ini">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attr">anon_upload_enable</span>=<span class="literal">YES</span>   <span class="comment">#允许匿名用户上传</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <figure class="highlight ini">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attr">anon_mkdir_write_enable</span>=<span class="literal">YES</span>   <span class="comment">#允许匿名用户创建目录文件</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>其他的就不用管了，保存文件。 重启vsftpd服务器</p>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">sudo<span class="built_in"> service </span>vsftpd restart</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>设置完了这些之后，其他人就能来访问你的FTP服务器了。 现在你可以登录你的服务器来尝试一下了。 现在应该能登录进去，但是里面什么也没有。 因为匿名用户默认访问的是你的 /srv/ftp 文件夹 现在我们需要两个功能，一个用来上传的，一个用来下载的 上传的文件夹，其他人可以上传到这个文件夹，但是不能有删除权限，试想如果有匿名登录进来的给你删除掉了别人好心给你分享的文件还行吗？ 下载的文件夹，其他人只能读取这个文件夹，但是不能修改这个文件夹，也就是你要分享给其他人的文件可以放到这里面。 我们在/srv/ftp 文件夹新建两个文件夹，一个是upload，一个是download 执行下面的两条指令</p>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">sudo chmod -R <span class="number">777</span> /srv/ftp/upload</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">sudo chmod -R <span class="number">755</span> /srv/ftp/download</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>这样就把upload的权限设置为可读可写，把download权限设置为可读不可写。 配置完上面的内容，就大功告成啦，登录FTP服务器后，你就可以看到一个upload文件夹，一个download文件夹。 是不是很简单。 现在下面的事情你就可以实现了： 1. 学校里某个同学有一个非常好看的电影，而你现在又不方便去接受，发网盘又太慢，你就把你的FTP地址扔给他，对他说，你上传到 ftp://&lt;你的IP地址&gt;/upload 文件夹下吧，我回去的时候取下来看。 2. 你剪辑了一个很不错的视频短片，想分享给学校里的小伙伴，你就可以把它扔到你的FTP服务器 /srv/ftp/download 目录下，然后对小伙伴们说，我的视频已经共享了，你们到 ftp://&lt;你的IP地址&gt;/download 里面去下载吧。 恩，只要你配置好了FTP，就能享受FTP局域网高速传输，分分钟搞定~ 如果配置有问题，欢迎与我联系~</p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-11-22 23:00:09" itemprop="dateCreated datePublished" datetime="2014-11-22T23:00:09+08:00">2014-11-22</time>
                </span>
                <span id="/436.html" class="post-meta-item leancloud_visitors" data-flag-title="在Ubuntu下搭建FTP服务器的方法" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>1.6k</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>1 分钟</span>
                </span>
              </div>
            </article>
            <script>
              document.querySelectorAll('.random').forEach(item => item.src = "https://picsum.photos/id/" + Math.floor(Math.random() * Math.floor(300)) + "/200/133")

            </script>
            <nav class="pagination">
              <a class="extend prev" rel="prev" href="/page/28/"><i class="fa fa-angle-left" aria-label="上一页"></i></a><a class="page-number" href="/">1</a><span class="space">&hellip;</span><a class="page-number" href="/page/28/">28</a><span class="page-number current">29</span><a class="page-number" href="/page/30/">30</a><a class="page-number" href="/page/31/">31</a><a class="extend next" rel="next" href="/page/30/"><i class="fa fa-angle-right" aria-label="下一页"></i></a>
            </nav>
          </div>
          <script>
            window.addEventListener('tabs:register', () =>
            {
              let
              {
                activeClass
              } = CONFIG.comments;
              if (CONFIG.comments.storage)
              {
                activeClass = localStorage.getItem('comments_active') || activeClass;
              }
              if (activeClass)
              {
                let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
                if (activeTab)
                {
                  activeTab.click();
                }
              }
            });
            if (CONFIG.comments.storage)
            {
              window.addEventListener('tabs:click', event =>
              {
                if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
                let commentClass = event.target.classList[1];
                localStorage.setItem('comments_active', commentClass);
              });
            }

          </script>
        </div>
        <div class="toggle sidebar-toggle">
          <span class="toggle-line toggle-line-first"></span>
          <span class="toggle-line toggle-line-middle"></span>
          <span class="toggle-line toggle-line-last"></span>
        </div>
        <aside class="sidebar">
          <div class="sidebar-inner">
            <ul class="sidebar-nav motion-element">
              <li class="sidebar-nav-toc"> 文章目录 </li>
              <li class="sidebar-nav-overview"> 站点概览 </li>
            </ul>
            <!--noindex-->
            <div class="post-toc-wrap sidebar-panel">
            </div>
            <!--/noindex-->
            <div class="site-overview-wrap sidebar-panel">
              <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
                <img class="site-author-image" itemprop="image" alt="崔庆才" src="/images/avatar.png">
                <p class="site-author-name" itemprop="name">崔庆才</p>
                <div class="site-description" itemprop="description">崔庆才的个人站点，记录生活的瞬间，分享学习的心得。</div>
              </div>
              <div class="site-state-wrap motion-element">
                <nav class="site-state">
                  <div class="site-state-item site-state-posts">
                    <a href="/archives/">
                      <span class="site-state-item-count">608</span>
                      <span class="site-state-item-name">日志</span>
                    </a>
                  </div>
                  <div class="site-state-item site-state-categories">
                    <a href="/categories/">
                      <span class="site-state-item-count">24</span>
                      <span class="site-state-item-name">分类</span></a>
                  </div>
                  <div class="site-state-item site-state-tags">
                    <a href="/tags/">
                      <span class="site-state-item-count">156</span>
                      <span class="site-state-item-name">标签</span></a>
                  </div>
                </nav>
              </div>
              <div class="links-of-author motion-element">
                <span class="links-of-author-item">
                  <a href="https://github.com/Germey" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;Germey" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
                </span>
                <span class="links-of-author-item">
                  <a href="mailto:cqc@cuiqingcai.com.com" title="邮件 → mailto:cqc@cuiqingcai.com.com" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i>邮件</a>
                </span>
                <span class="links-of-author-item">
                  <a href="https://weibo.com/cuiqingcai" title="微博 → https:&#x2F;&#x2F;weibo.com&#x2F;cuiqingcai" rel="noopener" target="_blank"><i class="fab fa-weibo fa-fw"></i>微博</a>
                </span>
                <span class="links-of-author-item">
                  <a href="https://www.zhihu.com/people/Germey" title="知乎 → https:&#x2F;&#x2F;www.zhihu.com&#x2F;people&#x2F;Germey" rel="noopener" target="_blank"><i class="fa fa-magic fa-fw"></i>知乎</a>
                </span>
              </div>
            </div>
            <div style=" width: 100%;" class="sidebar-panel sidebar-panel-image sidebar-panel-active">
              <a href="https://tutorial.lengyue.video/?coupon=12ef4b1a-a3db-11ea-bb37-0242ac130002_cqx_850" target="_blank" rel="noopener">
                <img src="https://qiniu.cuiqingcai.com/bco2a.png" style=" width: 100%;">
              </a>
            </div>
            <div style=" width: 100%;" class="sidebar-panel sidebar-panel-image sidebar-panel-active">
              <a href="http://www.ipidea.net/?utm-source=cqc&utm-keyword=?cqc" target="_blank" rel="noopener">
                <img src="https://qiniu.cuiqingcai.com/0ywun.png" style=" width: 100%;">
              </a>
            </div>
            <div class="sidebar-panel sidebar-panel-tags sidebar-panel-active">
              <h4 class="name"> 标签云 </h4>
              <div class="content">
                <a href="/tags/2048/" style="font-size: 10px;">2048</a> <a href="/tags/API/" style="font-size: 10px;">API</a> <a href="/tags/Bootstrap/" style="font-size: 11.25px;">Bootstrap</a> <a href="/tags/CDN/" style="font-size: 10px;">CDN</a> <a href="/tags/CQC/" style="font-size: 10px;">CQC</a> <a href="/tags/CSS/" style="font-size: 10px;">CSS</a> <a href="/tags/CSS-%E5%8F%8D%E7%88%AC%E8%99%AB/" style="font-size: 10px;">CSS 反爬虫</a> <a href="/tags/CV/" style="font-size: 10px;">CV</a> <a href="/tags/Django/" style="font-size: 10px;">Django</a> <a href="/tags/Eclipse/" style="font-size: 11.25px;">Eclipse</a> <a href="/tags/FTP/" style="font-size: 10px;">FTP</a> <a href="/tags/Git/" style="font-size: 10px;">Git</a> <a href="/tags/GitHub/" style="font-size: 13.75px;">GitHub</a> <a href="/tags/HTML5/" style="font-size: 10px;">HTML5</a> <a href="/tags/Hexo/" style="font-size: 10px;">Hexo</a> <a href="/tags/IT/" style="font-size: 10px;">IT</a> <a href="/tags/JSP/" style="font-size: 10px;">JSP</a> <a href="/tags/JavaScript/" style="font-size: 10px;">JavaScript</a> <a href="/tags/K8s/" style="font-size: 10px;">K8s</a> <a href="/tags/LOGO/" style="font-size: 10px;">LOGO</a> <a href="/tags/Linux/" style="font-size: 10px;">Linux</a> <a href="/tags/MIUI/" style="font-size: 10px;">MIUI</a> <a href="/tags/MongoDB/" style="font-size: 10px;">MongoDB</a> <a href="/tags/Mysql/" style="font-size: 10px;">Mysql</a> <a href="/tags/NBA/" style="font-size: 10px;">NBA</a> <a href="/tags/PHP/" style="font-size: 11.25px;">PHP</a> <a href="/tags/PS/" style="font-size: 10px;">PS</a> <a href="/tags/Pathlib/" style="font-size: 10px;">Pathlib</a> <a href="/tags/PhantomJS/" style="font-size: 10px;">PhantomJS</a> <a href="/tags/Python/" style="font-size: 15px;">Python</a> <a href="/tags/Python3/" style="font-size: 12.5px;">Python3</a> <a href="/tags/Pythonic/" style="font-size: 10px;">Pythonic</a> <a href="/tags/QQ/" style="font-size: 10px;">QQ</a> <a href="/tags/Redis/" style="font-size: 10px;">Redis</a> <a href="/tags/SAE/" style="font-size: 10px;">SAE</a> <a href="/tags/SSH/" style="font-size: 10px;">SSH</a> <a href="/tags/SVG/" style="font-size: 10px;">SVG</a> <a href="/tags/Scrapy/" style="font-size: 10px;">Scrapy</a> <a href="/tags/Scrapy-redis/" style="font-size: 10px;">Scrapy-redis</a> <a href="/tags/Scrapy%E5%88%86%E5%B8%83%E5%BC%8F/" style="font-size: 10px;">Scrapy分布式</a> <a href="/tags/Selenium/" style="font-size: 10px;">Selenium</a> <a href="/tags/TKE/" style="font-size: 10px;">TKE</a> <a href="/tags/Ubuntu/" style="font-size: 11.25px;">Ubuntu</a> <a href="/tags/VS-Code/" style="font-size: 10px;">VS Code</a> <a href="/tags/Vs-Code/" style="font-size: 10px;">Vs Code</a> <a href="/tags/Vue/" style="font-size: 11.25px;">Vue</a> <a href="/tags/Webpack/" style="font-size: 10px;">Webpack</a> <a href="/tags/Windows/" style="font-size: 10px;">Windows</a> <a href="/tags/Winpcap/" style="font-size: 10px;">Winpcap</a> <a href="/tags/WordPress/" style="font-size: 13.75px;">WordPress</a> <a href="/tags/Youtube/" style="font-size: 11.25px;">Youtube</a> <a href="/tags/android/" style="font-size: 10px;">android</a> <a href="/tags/ansible/" style="font-size: 10px;">ansible</a> <a href="/tags/cocos2d-x/" style="font-size: 10px;">cocos2d-x</a> <a href="/tags/e6/" style="font-size: 10px;">e6</a> <a href="/tags/fitvids/" style="font-size: 10px;">fitvids</a> <a href="/tags/git/" style="font-size: 11.25px;">git</a> <a href="/tags/json/" style="font-size: 10px;">json</a> <a href="/tags/js%E9%80%86%E5%90%91/" style="font-size: 10px;">js逆向</a> <a href="/tags/kubernetes/" style="font-size: 10px;">kubernetes</a> <a href="/tags/log/" style="font-size: 10px;">log</a> <a href="/tags/logging/" style="font-size: 10px;">logging</a> <a href="/tags/matlab/" style="font-size: 11.25px;">matlab</a> <a href="/tags/python/" style="font-size: 20px;">python</a> <a href="/tags/pytube/" style="font-size: 11.25px;">pytube</a> <a href="/tags/pywin32/" style="font-size: 10px;">pywin32</a> <a href="/tags/style/" style="font-size: 10px;">style</a> <a href="/tags/tomcat/" style="font-size: 10px;">tomcat</a> <a href="/tags/ubuntu/" style="font-size: 10px;">ubuntu</a> <a href="/tags/uwsgi/" style="font-size: 10px;">uwsgi</a> <a href="/tags/vsftpd/" style="font-size: 10px;">vsftpd</a> <a href="/tags/wamp/" style="font-size: 10px;">wamp</a> <a href="/tags/wineQQ/" style="font-size: 10px;">wineQQ</a> <a href="/tags/%E4%B8%83%E7%89%9B/" style="font-size: 11.25px;">七牛</a> <a href="/tags/%E4%B8%8A%E6%B5%B7/" style="font-size: 10px;">上海</a> <a href="/tags/%E4%B8%AA%E4%BA%BA%E7%BD%91%E7%AB%99/" style="font-size: 10px;">个人网站</a> <a href="/tags/%E4%B8%BB%E9%A2%98/" style="font-size: 10px;">主题</a> <a href="/tags/%E4%BA%91%E4%BA%A7%E5%93%81/" style="font-size: 10px;">云产品</a> <a href="/tags/%E4%BA%91%E5%AD%98%E5%82%A8/" style="font-size: 10px;">云存储</a> <a href="/tags/%E4%BA%AC%E4%B8%9C%E4%BA%91/" style="font-size: 10px;">京东云</a> <a href="/tags/%E4%BA%BA%E5%B7%A5%E6%99%BA%E8%83%BD/" style="font-size: 12.5px;">人工智能</a> <a href="/tags/%E4%BB%A3%E7%90%86/" style="font-size: 10px;">代理</a> <a href="/tags/%E4%BB%A3%E7%A0%81/" style="font-size: 10px;">代码</a> <a href="/tags/%E4%BB%A3%E7%A0%81%E5%88%86%E4%BA%AB%E5%9B%BE/" style="font-size: 10px;">代码分享图</a> <a href="/tags/%E4%BC%98%E5%8C%96/" style="font-size: 10px;">优化</a> <a href="/tags/%E4%BD%8D%E8%BF%90%E7%AE%97/" style="font-size: 10px;">位运算</a> <a href="/tags/%E5%85%AC%E4%BC%97%E5%8F%B7/" style="font-size: 10px;">公众号</a> <a href="/tags/%E5%88%86%E4%BA%AB/" style="font-size: 10px;">分享</a> <a href="/tags/%E5%88%86%E5%B8%83%E5%BC%8F/" style="font-size: 10px;">分布式</a> <a href="/tags/%E5%88%9B%E4%B8%9A/" style="font-size: 10px;">创业</a> <a href="/tags/%E5%89%8D%E7%AB%AF/" style="font-size: 12.5px;">前端</a> <a href="/tags/%E5%8D%9A%E5%AE%A2/" style="font-size: 10px;">博客</a> <a href="/tags/%E5%8E%9F%E7%94%9FAPP/" style="font-size: 10px;">原生APP</a> <a href="/tags/%E5%8F%8D%E7%88%AC%E8%99%AB/" style="font-size: 12.5px;">反爬虫</a> <a href="/tags/%E5%91%BD%E4%BB%A4/" style="font-size: 10px;">命令</a> <a href="/tags/%E5%93%8D%E5%BA%94%E5%BC%8F%E5%B8%83%E5%B1%80/" style="font-size: 10px;">响应式布局</a> <a href="/tags/%E5%9E%83%E5%9C%BE%E9%82%AE%E4%BB%B6/" style="font-size: 10px;">垃圾邮件</a> <a href="/tags/%E5%9F%9F%E5%90%8D%E7%BB%91%E5%AE%9A/" style="font-size: 10px;">域名绑定</a> <a href="/tags/%E5%A4%8D%E7%9B%98/" style="font-size: 10px;">复盘</a> <a href="/tags/%E5%A4%A7%E4%BC%97%E7%82%B9%E8%AF%84/" style="font-size: 10px;">大众点评</a> <a href="/tags/%E5%AD%97%E4%BD%93%E5%8F%8D%E7%88%AC%E8%99%AB/" style="font-size: 10px;">字体反爬虫</a> <a href="/tags/%E5%AD%97%E7%AC%A6%E9%97%AE%E9%A2%98/" style="font-size: 10px;">字符问题</a> <a href="/tags/%E5%AD%A6%E4%B9%A0%E6%96%B9%E6%B3%95/" style="font-size: 10px;">学习方法</a> <a href="/tags/%E5%AE%89%E5%8D%93/" style="font-size: 10px;">安卓</a> <a href="/tags/%E5%AE%9E%E7%94%A8/" style="font-size: 10px;">实用</a> <a href="/tags/%E5%B0%81%E9%9D%A2/" style="font-size: 10px;">封面</a> <a href="/tags/%E5%B4%94%E5%BA%86%E6%89%8D/" style="font-size: 18.75px;">崔庆才</a> <a href="/tags/%E5%B7%A5%E5%85%B7/" style="font-size: 12.5px;">工具</a> <a href="/tags/%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/" style="font-size: 10px;">开发工具</a> <a href="/tags/%E5%BE%AE%E8%BD%AF/" style="font-size: 10px;">微软</a> <a href="/tags/%E6%80%9D%E8%80%83/" style="font-size: 10px;">思考</a> <a href="/tags/%E6%89%8B%E6%9C%BA%E8%AE%BF%E9%97%AE/" style="font-size: 10px;">手机访问</a> <a href="/tags/%E6%95%99%E7%A8%8B/" style="font-size: 10px;">教程</a> <a href="/tags/%E6%95%99%E8%82%B2/" style="font-size: 10px;">教育</a> <a href="/tags/%E6%96%B0%E4%B9%A6/" style="font-size: 12.5px;">新书</a> <a href="/tags/%E6%96%B9%E6%B3%95%E8%AE%BA/" style="font-size: 10px;">方法论</a> <a href="/tags/%E6%97%85%E6%B8%B8/" style="font-size: 10px;">旅游</a> <a href="/tags/%E6%97%A5%E5%BF%97/" style="font-size: 10px;">日志</a> <a href="/tags/%E6%9A%97%E6%97%B6%E9%97%B4/" style="font-size: 10px;">暗时间</a> <a href="/tags/%E6%9D%9C%E5%85%B0%E7%89%B9/" style="font-size: 11.25px;">杜兰特</a> <a href="/tags/%E6%A1%8C%E9%9D%A2/" style="font-size: 10px;">桌面</a> <a href="/tags/%E6%AD%8C%E5%8D%95/" style="font-size: 10px;">歌单</a> <a href="/tags/%E6%B1%9F%E5%8D%97/" style="font-size: 10px;">江南</a> <a href="/tags/%E6%B8%B8%E6%88%8F/" style="font-size: 10px;">游戏</a> <a href="/tags/%E7%84%A6%E8%99%91/" style="font-size: 10px;">焦虑</a> <a href="/tags/%E7%88%AC%E8%99%AB/" style="font-size: 16.25px;">爬虫</a> <a href="/tags/%E7%88%AC%E8%99%AB%E4%B9%A6%E7%B1%8D/" style="font-size: 11.25px;">爬虫书籍</a> <a href="/tags/%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F/" style="font-size: 10px;">环境变量</a> <a href="/tags/%E7%94%9F%E6%B4%BB%E7%AC%94%E8%AE%B0/" style="font-size: 10px;">生活笔记</a> <a href="/tags/%E7%99%BB%E5%BD%95/" style="font-size: 10px;">登录</a> <a href="/tags/%E7%9F%A5%E4%B9%8E/" style="font-size: 10px;">知乎</a> <a href="/tags/%E7%9F%AD%E4%BF%A1/" style="font-size: 10px;">短信</a> <a href="/tags/%E7%9F%AD%E4%BF%A1%E9%AA%8C%E8%AF%81%E7%A0%81/" style="font-size: 10px;">短信验证码</a> <a href="/tags/%E7%AC%94%E8%AE%B0%E8%BD%AF%E4%BB%B6/" style="font-size: 10px;">笔记软件</a> <a href="/tags/%E7%AF%AE%E7%BD%91/" style="font-size: 10px;">篮网</a> <a href="/tags/%E7%BA%B8%E5%BC%A0/" style="font-size: 10px;">纸张</a> <a href="/tags/%E7%BB%84%E4%BB%B6/" style="font-size: 10px;">组件</a> <a href="/tags/%E7%BD%91%E7%AB%99/" style="font-size: 10px;">网站</a> <a href="/tags/%E7%BD%91%E7%BB%9C%E7%88%AC%E8%99%AB/" style="font-size: 11.25px;">网络爬虫</a> <a href="/tags/%E7%BE%8E%E5%AD%A6/" style="font-size: 10px;">美学</a> <a href="/tags/%E8%82%89%E5%A4%B9%E9%A6%8D/" style="font-size: 10px;">肉夹馍</a> <a href="/tags/%E8%85%BE%E8%AE%AF%E4%BA%91/" style="font-size: 10px;">腾讯云</a> <a href="/tags/%E8%87%AA%E5%BE%8B/" style="font-size: 10px;">自律</a> <a href="/tags/%E8%A5%BF%E5%B0%91%E7%88%B7/" style="font-size: 10px;">西少爷</a> <a href="/tags/%E8%A7%86%E9%A2%91/" style="font-size: 10px;">视频</a> <a href="/tags/%E8%B0%B7%E6%AD%8C%E9%AA%8C%E8%AF%81%E7%A0%81/" style="font-size: 10px;">谷歌验证码</a> <a href="/tags/%E8%BF%90%E8%90%A5/" style="font-size: 10px;">运营</a> <a href="/tags/%E8%BF%9C%E7%A8%8B/" style="font-size: 10px;">远程</a> <a href="/tags/%E9%80%86%E5%90%91/" style="font-size: 10px;">逆向</a> <a href="/tags/%E9%85%8D%E7%BD%AE/" style="font-size: 10px;">配置</a> <a href="/tags/%E9%87%8D%E8%A3%85/" style="font-size: 10px;">重装</a> <a href="/tags/%E9%98%BF%E6%9D%9C/" style="font-size: 10px;">阿杜</a> <a href="/tags/%E9%9D%99%E8%A7%85/" style="font-size: 17.5px;">静觅</a> <a href="/tags/%E9%A2%A0%E8%A6%86/" style="font-size: 10px;">颠覆</a> <a href="/tags/%E9%A3%9E%E4%BF%A1/" style="font-size: 10px;">飞信</a> <a href="/tags/%E9%B8%BF%E8%92%99/" style="font-size: 10px;">鸿蒙</a>
              </div>
              <script>
                const tagsColors = ['#00a67c', '#5cb85c', '#d9534f', '#567e95', '#b37333', '#f4843d', '#15a287']
                const tagsElements = document.querySelectorAll('.sidebar-panel-tags .content a')
                tagsElements.forEach((item) =>
                {
                  item.style.backgroundColor = tagsColors[Math.floor(Math.random() * tagsColors.length)]
                })

              </script>
            </div>
            <div class="sidebar-panel sidebar-panel-categories sidebar-panel-active">
              <h4 class="name"> 分类 </h4>
              <div class="content">
                <ul class="category-list">
                  <li class="category-list-item"><a class="category-list-link" href="/categories/C-C/">C/C++</a><span class="category-list-count">23</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/HTML/">HTML</a><span class="category-list-count">14</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/Java/">Java</a><span class="category-list-count">5</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/JavaScript/">JavaScript</a><span class="category-list-count">26</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/Linux/">Linux</a><span class="category-list-count">15</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/Markdown/">Markdown</a><span class="category-list-count">1</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/Net/">Net</a><span class="category-list-count">4</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/Other/">Other</a><span class="category-list-count">39</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/PHP/">PHP</a><span class="category-list-count">27</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/Paper/">Paper</a><span class="category-list-count">2</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/Python/">Python</a><span class="category-list-count">261</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/TypeScript/">TypeScript</a><span class="category-list-count">2</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/%E4%B8%AA%E4%BA%BA%E5%B1%95%E7%A4%BA/">个人展示</a><span class="category-list-count">1</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/%E4%B8%AA%E4%BA%BA%E6%97%A5%E8%AE%B0/">个人日记</a><span class="category-list-count">9</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/%E4%B8%AA%E4%BA%BA%E8%AE%B0%E5%BD%95/">个人记录</a><span class="category-list-count">4</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/%E4%B8%AA%E4%BA%BA%E9%9A%8F%E7%AC%94/">个人随笔</a><span class="category-list-count">15</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/">安装配置</a><span class="category-list-count">59</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/%E6%8A%80%E6%9C%AF%E6%9D%82%E8%B0%88/">技术杂谈</a><span class="category-list-count">88</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/%E6%9C%AA%E5%88%86%E7%B1%BB/">未分类</a><span class="category-list-count">1</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/%E7%94%9F%E6%B4%BB%E7%AC%94%E8%AE%B0/">生活笔记</a><span class="category-list-count">1</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/%E7%A6%8F%E5%88%A9%E4%B8%93%E5%8C%BA/">福利专区</a><span class="category-list-count">6</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/%E8%81%8C%E4%BD%8D%E6%8E%A8%E8%8D%90/">职位推荐</a><span class="category-list-count">2</span></li>
                </ul>
              </div>
            </div>
            <div class="sidebar-panel sidebar-panel-friends sidebar-panel-active">
              <h4 class="name"> 友情链接 </h4>
              <ul class="friends">
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/j2dub.jpg">
                  </span>
                  <span class="link">
                    <a href="https://www.findhao.net/" target="_blank" rel="noopener">FindHao</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/ou6mm.jpg">
                  </span>
                  <span class="link">
                    <a href="https://diygod.me/" target="_blank" rel="noopener">DIYgod</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/6apxu.jpg">
                  </span>
                  <span class="link">
                    <a href="https://www.51dev.com/" target="_blank" rel="noopener">IT技术社区</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://www.jankl.com/img/titleshu.jpg">
                  </span>
                  <span class="link">
                    <a href="https://www.jankl.com/" target="_blank" rel="noopener">liberalist</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/bqlbs.png">
                  </span>
                  <span class="link">
                    <a href="http://www.urselect.com/" target="_blank" rel="noopener">优社电商</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/8s88c.jpg">
                  </span>
                  <span class="link">
                    <a href="https://www.yuanrenxue.com/" target="_blank" rel="noopener">猿人学</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/2wgg5.jpg">
                  </span>
                  <span class="link">
                    <a href="https://www.yunlifang.cn/" target="_blank" rel="noopener">云立方</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/shwr6.png">
                  </span>
                  <span class="link">
                    <a href="http://lanbing510.info/" target="_blank" rel="noopener">冰蓝</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/blvoh.jpg">
                  </span>
                  <span class="link">
                    <a href="https://lengyue.me/" target="_blank" rel="noopener">冷月</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="http://qianxunclub.com/favicon.png">
                  </span>
                  <span class="link">
                    <a href="http://qianxunclub.com/" target="_blank" rel="noopener">千寻啊千寻</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/0044u.jpg">
                  </span>
                  <span class="link">
                    <a href="http://kodcloud.com/" target="_blank" rel="noopener">可道云</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/ygnpn.jpg">
                  </span>
                  <span class="link">
                    <a href="http://www.kunkundashen.cn/" target="_blank" rel="noopener">坤坤大神</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/22uv1.png">
                  </span>
                  <span class="link">
                    <a href="http://www.cenchong.com/" target="_blank" rel="noopener">岑冲博客</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/ev9kl.png">
                  </span>
                  <span class="link">
                    <a href="http://www.zxiaoji.com/" target="_blank" rel="noopener">张小鸡</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://www.503error.com/favicon.ico">
                  </span>
                  <span class="link">
                    <a href="https://www.503error.com/" target="_blank" rel="noopener">张志明个人博客</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/x714o.jpg">
                  </span>
                  <span class="link">
                    <a href="http://www.hubwiz.com/" target="_blank" rel="noopener">汇智网</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/129d8.png">
                  </span>
                  <span class="link">
                    <a href="https://www.bysocket.com/" target="_blank" rel="noopener">泥瓦匠BYSocket</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://www.xiongge.club/favicon.ico">
                  </span>
                  <span class="link">
                    <a href="https://www.xiongge.club/" target="_blank" rel="noopener">熊哥club</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/3w4fe.png">
                  </span>
                  <span class="link">
                    <a href="https://zerlong.com/" target="_blank" rel="noopener">知语</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/44hxf.png">
                  </span>
                  <span class="link">
                    <a href="http://redstonewill.com/" target="_blank" rel="noopener">红色石头</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/8g1fk.jpg">
                  </span>
                  <span class="link">
                    <a href="http://www.laodong.me/" target="_blank" rel="noopener">老董博客</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/wkaus.jpg">
                  </span>
                  <span class="link">
                    <a href="https://zhaoshuai.me/" target="_blank" rel="noopener">碎念</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/pgo0r.jpg">
                  </span>
                  <span class="link">
                    <a href="https://www.chenwenguan.com/" target="_blank" rel="noopener">陈文管的博客</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/kk82a.jpg">
                  </span>
                  <span class="link">
                    <a href="https://www.lxlinux.net/" target="_blank" rel="noopener">良许Linux教程网</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/lj0t2.jpg">
                  </span>
                  <span class="link">
                    <a href="https://tanqingbo.cn/" target="_blank" rel="noopener">IT码农</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/i8cdr.png">
                  </span>
                  <span class="link">
                    <a href="https://junyiseo.com/" target="_blank" rel="noopener">均益个人博客</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/chwv2.png">
                  </span>
                  <span class="link">
                    <a href="https://brucedone.com/" target="_blank" rel="noopener">大鱼的鱼塘</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/2y43o.png">
                  </span>
                  <span class="link">
                    <a href="http://bbs.nightteam.cn/" target="_blank" rel="noopener">夜幕爬虫安全论坛</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/zvc3w.jpg">
                  </span>
                  <span class="link">
                    <a href="https://www.weishidong.com/" target="_blank" rel="noopener">韦世东的技术专栏</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/ebudy.jpg">
                  </span>
                  <span class="link">
                    <a href="https://chuanjiabing.com/" target="_blank" rel="noopener">穿甲兵技术社区</a>
                  </span>
                </li>
              </ul>
            </div>
          </div>
        </aside>
        <div id="sidebar-dimmer"></div>
      </div>
    </main>
    <footer class="footer">
      <div class="footer-inner">
        <div class="copyright"> &copy; <span itemprop="copyrightYear">2021</span>
          <span class="with-love">
            <i class="fa fa-heart"></i>
          </span>
          <span class="author" itemprop="copyrightHolder">崔庆才丨静觅</span>
          <span class="post-meta-divider">|</span>
          <span class="post-meta-item-icon">
            <i class="fa fa-chart-area"></i>
          </span>
          <span title="站点总字数">2.6m</span>
          <span class="post-meta-divider">|</span>
          <span class="post-meta-item-icon">
            <i class="fa fa-coffee"></i>
          </span>
          <span title="站点阅读时长">39:54</span>
        </div>
        <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://pisces.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Pisces</a> 强力驱动 </div>
        <div class="beian"><a href="https://beian.miit.gov.cn/" rel="noopener" target="_blank">京ICP备18015597号-1 </a>
        </div>
        <script>
          (function ()
          {
            function leancloudSelector(url)
            {
              url = encodeURI(url);
              return document.getElementById(url).querySelector('.leancloud-visitors-count');
            }

            function addCount(Counter)
            {
              var visitors = document.querySelector('.leancloud_visitors');
              var url = decodeURI(visitors.id);
              var title = visitors.dataset.flagTitle;
              Counter('get', '/classes/Counter?where=' + encodeURIComponent(JSON.stringify(
              {
                url
              }))).then(response => response.json()).then((
              {
                results
              }) =>
              {
                if (results.length > 0)
                {
                  var counter = results[0];
                  leancloudSelector(url).innerText = counter.time + 1;
                  Counter('put', '/classes/Counter/' + counter.objectId,
                  {
                    time:
                    {
                      '__op': 'Increment',
                      'amount': 1
                    }
                  }).catch(error =>
                  {
                    console.error('Failed to save visitor count', error);
                  });
                }
                else
                {
                  Counter('post', '/classes/Counter',
                  {
                    title,
                    url,
                    time: 1
                  }).then(response => response.json()).then(() =>
                  {
                    leancloudSelector(url).innerText = 1;
                  }).catch(error =>
                  {
                    console.error('Failed to create', error);
                  });
                }
              }).catch(error =>
              {
                console.error('LeanCloud Counter Error', error);
              });
            }

            function showTime(Counter)
            {
              var visitors = document.querySelectorAll('.leancloud_visitors');
              var entries = [...visitors].map(element =>
              {
                return decodeURI(element.id);
              });
              Counter('get', '/classes/Counter?where=' + encodeURIComponent(JSON.stringify(
              {
                url:
                {
                  '$in': entries
                }
              }))).then(response => response.json()).then((
              {
                results
              }) =>
              {
                for (let url of entries)
                {
                  let target = results.find(item => item.url === url);
                  leancloudSelector(url).innerText = target ? target.time : 0;
                }
              }).catch(error =>
              {
                console.error('LeanCloud Counter Error', error);
              });
            }
            let
            {
              app_id,
              app_key,
              server_url
            } = {
              "enable": true,
              "app_id": "6X5dRQ0pnPWJgYy8SXOg0uID-gzGzoHsz",
              "app_key": "ziLDVEy73ne5HtFTiGstzHMS",
              "server_url": "https://6x5drq0p.lc-cn-n1-shared.com",
              "security": false
            };

            function fetchData(api_server)
            {
              var Counter = (method, url, data) =>
              {
                return fetch(`${api_server}/1.1${url}`,
                {
                  method,
                  headers:
                  {
                    'X-LC-Id': app_id,
                    'X-LC-Key': app_key,
                    'Content-Type': 'application/json',
                  },
                  body: JSON.stringify(data)
                });
              };
              if (CONFIG.page.isPost)
              {
                if (CONFIG.hostname !== location.hostname) return;
                addCount(Counter);
              }
              else if (document.querySelectorAll('.post-title-link').length >= 1)
              {
                showTime(Counter);
              }
            }
            let api_server = app_id.slice(-9) !== '-MdYXbMMI' ? server_url : `https://${app_id.slice(0, 8).toLowerCase()}.api.lncldglobal.com`;
            if (api_server)
            {
              fetchData(api_server);
            }
            else
            {
              fetch('https://app-router.leancloud.cn/2/route?appId=' + app_id).then(response => response.json()).then((
              {
                api_server
              }) =>
              {
                fetchData('https://' + api_server);
              });
            }
          })();

        </script>
      </div>
      <div class="footer-stat">
        <span id="cnzz_stat_icon_1279355174"></span>
        <script type="text/javascript">
          document.write(unescape("%3Cspan id='cnzz_stat_icon_1279355174'%3E%3C/span%3E%3Cscript src='https://v1.cnzz.com/z_stat.php%3Fid%3D1279355174%26online%3D1%26show%3Dline' type='text/javascript'%3E%3C/script%3E"));

        </script>
      </div>
    </footer>
  </div>
  <script src="//cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/pangu@4/dist/browser/pangu.min.js"></script>
  <script src="/js/utils.js"></script>
  <script src="/.js"></script>
  <script src="/js/schemes/pisces.js"></script>
  <script src="/.js"></script>
  <script src="/js/next-boot.js"></script>
  <script src="/.js"></script>
  <script>
    (function ()
    {
      var canonicalURL, curProtocol;
      //Get the <link> tag
      var x = document.getElementsByTagName("link");
      //Find the last canonical URL
      if (x.length > 0)
      {
        for (i = 0; i < x.length; i++)
        {
          if (x[i].rel.toLowerCase() == 'canonical' && x[i].href)
          {
            canonicalURL = x[i].href;
          }
        }
      }
      //Get protocol
      if (!canonicalURL)
      {
        curProtocol = window.location.protocol.split(':')[0];
      }
      else
      {
        curProtocol = canonicalURL.split(':')[0];
      }
      //Get current URL if the canonical URL does not exist
      if (!canonicalURL) canonicalURL = window.location.href;
      //Assign script content. Replace current URL with the canonical URL
      ! function ()
      {
        var e = /([http|https]:\/\/[a-zA-Z0-9\_\.]+\.baidu\.com)/gi,
          r = canonicalURL,
          t = document.referrer;
        if (!e.test(r))
        {
          var n = (String(curProtocol).toLowerCase() === 'https') ? "https://sp0.baidu.com/9_Q4simg2RQJ8t7jm9iCKT-xh_/s.gif" : "//api.share.baidu.com/s.gif";
          t ? (n += "?r=" + encodeURIComponent(document.referrer), r && (n += "&l=" + r)) : r && (n += "?l=" + r);
          var i = new Image;
          i.src = n
        }
      }(window);
    })();

  </script>
  <script src="/js/local-search.js"></script>
  <script src="/.js"></script>
</body>

</html>
